如何在执行maven-assembly-plugin之前包含一些依赖项

时间:2014-10-28 01:58:12

标签: maven

我有一个问题如下:

在项目的文件pom.xml中

我想在将项目打包到jar文件

之前为项目添加一些依赖项
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.5.1</version>
    <executions>
        <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
                <goal>copy-dependencies</goal>
            </goals>
            <configuration>
                <includeArtifactIds>
                    <!-- some depedencies -->
                </includeArtifactIds>
                <outputDirectory>${basedir}/somewhere</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.4</version>
    <executions>
        <execution>
            <id>generateSingle</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
            <configuration>
                <finalName>${project.artifactId}-${project.version}-full</finalName>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies </descriptorRef>
                </descriptorRefs>
                <appendAssemblyId>false</appendAssemblyId>
                <archive>
                    <manifest>
                    </manifest>
                </archive>
            </configuration>
        </execution>
    </executions>
</plugin>

但是在执行maven install之后,jar文件仍然不包含maven-dependency-plugin创建的依赖项。我试图改变maven-dependency-plugin中的一些阶段,但结果也没有改变。

0 个答案:

没有答案