maven assembly create jar with dependency and class path

大城市里の小女人 提交于 2019-12-05 20:22:54

He was probably reconfiguring his maven dependency plugin:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.10</version>
            <executions>
                <execution>
                    <id>copy</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${distDirectory}/lib</outputDirectory>
                        <includeScope>runtime</includeScope>
                    </configuration>
                </execution>
            </executions>
        </plugin>

Now, when your run mvn package, all your dependency jars will go to target/lib (or whatever your distDirectory is).

HTH

If maven-jar-plugin is not generating the entry Class-Path in the manifest file although you have set <addClasspath>true</addClasspath>, make sure you are using version 2.2 or newer of the plugin.

It seems that the bug MJAR-83 in version 2.1 was preventing the plugin from listing the dependencies in Class-Path.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!