在部署文件

时间:2015-09-28 14:45:03

标签: maven

我在maven-assembly-plugin中生成具有特定名称的zip文件,并希望能够部署它。 我在初始化阶段定义$ [my-version}属性并成功获取文件,但是当deoplying我得到以下错误时:

  

[ERROR]   无法执行目标org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file(default-cli)       在项目my-project上:C:\ Users \ pr \ work \ my-project \ target \ target \ my-file - $ {my-version} .zip not found。        - > [帮助1]

代码:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-deploy-plugin</artifactId>
    <version>2.7</version>
    <configuration>          
        <file>target/my-file-${my-version}.zip</file>
        <repositoryId>releases</repositoryId>
        <url>${nexus.url}/content/repositories/releases</url>
    </configuration>
    <executions>
        <execution>
            <phase>deploy</phase>
            <goals>
                <goal>deploy-file</goal>
            </goals>
        </execution>
    </executions>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.5.5</version>
    <configuration>
        <finalName>my-file-${my-version}</finalName>
        <appendAssemblyId>false</appendAssemblyId>
        <descriptors>
          <descriptor>src/main/assembly/deployment.xml</descriptor>
        </descriptors>          
    </configuration>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>

1 个答案:

答案 0 :(得分:0)

问题在于阶段的顺序。调用目标&#34; deploy:deploy-file&#34;直接,阶段&#34;初始化&#34;没有处理。 因此,其中一种方法是明确地调用它:

  

mvn初始化部署文件