Mat*_*cke 19 jar maven-plugin maven maven-assembly-plugin
我想在maven中构建一个带有依赖项的.jar文件.不幸的是,我必须在buildpath中包含一些外部.jars.当我现在尝试使用maven包构建此项目时,我将收到一个错误,即找不到那些外部.jars.
如何调整我的pom文件来添加这些罐子?当前:
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
Run Code Online (Sandbox Code Playgroud)
小智 6
您需要使用以下命令将外部jar添加到.m2文件夹中
mvn install:install-file -Dfile=[JAR] -DgroupId=[some.group] -DartifactId=[Some Id] -Dversion=1.0.0 -Dpackaging=jar
Run Code Online (Sandbox Code Playgroud)
这会将给定的jar添加到.m2文件夹中.之后转到pom.xm并添加具有给定组ID,工件ID和版本的依赖项.
| 归档时间: |
|
| 查看次数: |
47603 次 |
| 最近记录: |