【发布时间】:2014-12-16 09:42:45
【问题描述】:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.company.Main</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
问题是我想在项目中保留一些本地依赖项。
我在pom.xml 中这样定义它们:
<dependency>
<groupId>groupid</groupId>
<artifactId>local</artifactId>
<version>1.1</version>
<scope>system</scope>
<systemPath>${basedir}/lib/local-utilities-1.1.jar</systemPath>
</dependency>
现在,当我打包整个东西时,maven-assembly-plugin 只打包了自动下载并在 repo 中可用的依赖项...这可能是因为那些本地 JAR 在编译阶段可用,而不是在打包阶段可用(对吗?)。
如何让这个插件也包含这些依赖项?我尝试将 <scope> 更改为 package 和其他阶段,但显然 Maven 不允许这样做。
【问题讨论】:
-
开始使用存储库管理器或使用Stephen Collony's plugin,这是比
system scope更好的解决方案。