Java 在eclipse中使用maven构建不会将本地jar的内容包含到可执行jar中
我有一个本地创建的jar:scp commons.jar类,我想将这些类打包到我的可执行jar:main.jar scp-commons.jar中的包结构: com.sample.commons* main.jar中的包结构: com.sample.client* 当我使用maven构建时,构建是成功的,但是scp commons.jar的类没有打包在我的main.jar中,因此jar抛出了一个类not found异常 下面是main.jar项目中的pom.xmlJava 在eclipse中使用maven构建不会将本地jar的内容包含到可执行jar中,java,maven,build,Java,Maven,Build,我有一个本地创建的jar:scp commons.jar类,我想将这些类打包到我的可执行jar:main.jar scp-commons.jar中的包结构: com.sample.commons* main.jar中的包结构: com.sample.client* 当我使用maven构建时,构建是成功的,但是scp commons.jar的类没有打包在我的main.jar中,因此jar抛出了一个类not found异常 下面是main.jar项目中的pom.xml `<de
`<dependencies>
<dependency>
<groupId>_GroupID1_</groupId>
<version>1</version>
<artifactId>scp-commons</artifactId>
<scope>system</scope>
<systemPath>${user.lib.path}\src\main\webapp\WEB-INF\lib\scp-commons.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${compiler.version.source}</source>
<target>${compiler.version.target}</target>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>toola-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>assemblytoola.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>com.sample.client.pat.toola.CpatToolA</mainClass>
</manifest>
</archive>
<finalName>CPATToolA</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>`
`
_组ID1_
1.
公共空间
系统
${user.lib.path}\src\main\webapp\WEB-INF\lib\scp-commons.jar
org.apache.maven.plugins
maven编译器插件
${compiler.version.source}
${compiler.version.target}
默认编译
编译
maven汇编插件
图拉装配
包裹
单一的
assemblytoola.xml
com.sample.client.pat.toola.CpatToolA
卡帕托拉
`
在这方面的任何帮助都将不胜感激。请查看此使用,不要使用
systemPath
。将jar安装到您的本地存储库中并从那里使用它。嗨,Jason,为了防止此类问题,请考虑一种更好的方法来设置您的项目。正如上面JF Meier所说,只需在本地存储库中安装库,或者如果这两个项目相互关联,则将它们作为多模块项目的模块。Eclipse(m2eclipse插件)然后正确地维护它们之间的依赖关系。。。thanx伙计们。。