dav*_*ija 9 classpath maven-3 maven maven-assembly-plugin
我有以下自定义程序集:
<assembly>
<id>full</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.outputDirectory}</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
Run Code Online (Sandbox Code Playgroud)
以下配置部分:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>com.example.MyExample</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>./lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
根据有关maven程序集插件的文档,这应该将一个类路径项添加到清单文件中,但它不起作用.如果我使用已弃用的程序集目标而不是单个目标,它确实有效.
我注意到有人提到存档部分只有jar格式,但这就是我正在使用的.
当他们弃用程序集:汇编时,他们是否定义了一种正确执行此操作的新方法?我真的不喜欢使用已弃用的功能,但如果它们破坏了工作方式并且没有正确记录它,我真的不知道如何避免这种情况.
有没有人有任何正确的例子?
这不是汇编插件的一个很好的用途。Java 不做罐子里的罐子。您可以使用 maven-jar-plugin 的配置选项将类路径添加到主 jar 的清单中,然后使用程序集插件来收集依赖项,然后将其放在 zip 或 tarball 中的主 jar 旁边。
http://maven.apache.org/shared/maven-archiver/examples/classpath.html
| 归档时间: |
|
| 查看次数: |
20544 次 |
| 最近记录: |