java-Maven Exec插件:如何配置工作目录
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了java-Maven Exec插件:如何配置工作目录,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2747字,纯文字阅读大概需要4分钟。
内容图文
![java-Maven Exec插件:如何配置工作目录](/upload/InfoBanner/zyjiaocheng/695/08a2f91ec77540c0ba694da6a9c50165.jpg)
我正在通过以下命令使用Exec Maven插件:
mvn exec:java
而且我没有用这种执行模式来设置工作目录.
我想使用mainClass(在特定的包中)
并且我希望执行的根文件夹位于${basedir}之外的其他目录中.
谢谢您的帮助.
我的pom.xml,其中的目标< workingDirectory>对我不起作用:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<workingDirectory>${project.build.directory}\classes</workingDirectory>
<mainClass>com.package.MyMainClass</mainClass>
<includeProjectDependencies>true</includeProjectDependencies>
</configuration>
</plugin>
-X选项的结果
[DEBUG] Configuring mojo org.codehaus.mojo:exec-maven-plugin:1.3.2:java from plugin realm ClassRealm[plugin>org.codehaus.mojo:exec-maven-plugin:1.3.2,parent: sun.misc.Launcher$AppClassLoader@11b86e7]
[DEBUG] Configuring mojo 'org.codehaus.mojo:exec-maven-plugin:1.3.2:java' with basic configurator -->
[DEBUG] (f) arguments = []
[DEBUG] (f) classpathScope = runtime
[DEBUG] (f) cleanupDaemonThreads = true
[DEBUG] (f) daemonThreadJoinTimeout = 15000
[DEBUG] (f) includePluginDependencies = false
[DEBUG] (f) includeProjectDependencies = true
[DEBUG] (f) keepAlive = false
[DEBUG] (f) killAfter = 1
[DEBUG] (f) localRepository = id: local url: file:///C:/Users/100728452/.m2/repository/ layout: none
[DEBUG] (f) mainClass = com.package.MyMainClass
[DEBUG] (f) pluginDependencies = [org.codehaus.mojo:exec-maven-plugin:maven-plugin:1.3.2:, org.codehaus.plexus:plexus...
[DEBUG] (f) skip = false
[DEBUG] (f) stopUnresponsiveDaemonThreads = false
[DEBUG] (s) key = sun.java2d.ddoffscreen
[DEBUG] (s) value = false
[DEBUG] (s) key = com.odi.OStoreLicenseFile
[DEBUG] (s) value = .\library\odi\etc\license.txt
[DEBUG] (f) systemProperties = [org.codehaus.mojo.exec.Property@194e776, org.codehaus.mojo.exec.Property@e80740]
[DEBUG] -- end configuration --
[WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6.
[DEBUG] Invoking : com.mypackage.MyMainClass.main()
[DEBUG] Plugin Dependencies will be excluded.
[DEBUG] Project Dependencies will be included.
[DEBUG] Collected project artifacts [javax.help:javahelp:jar:2.0.02:compile,
解决方法:
我没有使用exec:java找到解决方案.
所以,现在我改用exec:exec,因为我们可以设置workingDirectory并且可以.
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath />
<argument>com.package.MyMainClass</argument>
</arguments>
<workingDirectory>${project.build.outputDirectory}</workingDirectory>
</configuration>
内容总结
以上是互联网集市为您收集整理的java-Maven Exec插件:如何配置工作目录全部内容,希望文章能够帮你解决java-Maven Exec插件:如何配置工作目录所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。