最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Include dependencies using maven-jar-plugin - Stack Overflow

programmeradmin1浏览0评论

I've 3 projects business, tools & utils. Tools depends external projects like commons-cli and internal business & utils.

I'm using following build configuration.

<plugins>
    <plugin>
        <groupId>.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <configuration>
            <archive>
                <manifest>
                    <addClasspath>true</addClasspath>
                    <mainClass>my.mainClass</mainClass>
                    <classpathPrefix>lib/</classpathPrefix>
                </manifest>
            </archive>
            <excludes>
                <exclude>log4j.xml</exclude>
            </excludes>
        </configuration>
    </plugin>
    <plugin>
        <groupId>.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>
                    <outputDirectory>
                        ${project.build.directory}/lib/
                    </outputDirectory>
                </configuration>
            </execution>
        </executions>
    </plugin>
</plugins>

My project builds with following strucure.

tools.jar
lib/
    business.jar
    utils.jar
    common-cli.jar

Is there a way to merge tools.jar, business.jar and utils.jar (to tools-with-dep.jar as those are my internal projects) and have following structure.

tools-with-dep.jar
lib/
   commons-cli.jar
发布评论

评论列表(0)

  1. 暂无评论