我使用外部程序,创建jar . 此操作的代码如下:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<tasks>
<property environment="env" />
<property name="appname" value="hellojavaworld" />
<echoproperties />
<exec dir="" executable="respawn.exe" searchpath="true">
<arg value="${basedir}\src\main\java\${appname}.app" />
</exec>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
创建的jar由respawn.exe生成,后来在构建过程中使用 . 我想使用最合适的方法将第三方jar安装到本地maven存储库 . 为此目的,它使用命令:
mvn install:install-file -Dfile ...
这按设计工作 . 我想创建将在构建期间使用的pom.xml文件(父子),因此创建的jar将被复制到本地maven存储库 . 我无法做到这一点,因为maven创建了自己的jar,复制到本地存储库 . 问题是如何改变maven使用不同的jar?我不想复制创建maven的jar,因为它与respawn.exe创建的jar不同 .
Jar comparison此链接描述了这些 jar 的不同之处 . 您可以看到右侧的jar(maven本地存储库)错过了具有相应类的abc文件夹 .
问题是为什么?
1 回答
Maven将从
src/main/java
编译Java源文件(*.java
)到target/classes
. 这些类将由Maven打包到jar中 .PS 这里只显示Maven默认位置 .
看看你的问题,似乎你没有Java源文件 .