我有一个批处理文件,它使用依赖于tools.jar(来自JDK)的maven 运行java 类。
例如:
mvn -f .\pom.xml -e exec:java -Dfile.encoding="UTF-8" -Dexec.mainClass=MyClass -Dexec.args="%1 %2 %3 %4 %5 %6 %7 % 8 %9" -Dexec.classpathScope=运行时
我的程序使用 JDK 中的tools.jar,并且我在 maven 中添加了指向它的系统依赖项。
由于 exec:java 目标不包括系统依赖项,因此我想从命令行手动添加依赖项。
尽管我预计这很微不足道,但我可以找到方法来做到这一点。
任何帮助将不胜感激。
Thanks,
Avner
从我读到的maven 执行插件 http://mojo.codehaus.org/exec-maven-plugin/examples/example-exec-using-plugin-dependencies.html它允许您将可执行依赖项配置为插件依赖项。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<includeProjectDependencies>false</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<executableDependency>
<groupId>com.example.myproject</groupId>
<artifactId>mylib</artifactId>
</executableDependency>
<mainClass>com.example.Main</mainClass>
</configuration>
<dependencies>
<dependency>
<groupId>sun.jdk</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</plugin>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)