我用eclipse编写了一个复杂的Java应用程序,它使用项目文件夹中包含的许多.jar库.
有一种快速方法可以导出应用程序的运行配置,允许我从shell运行它(我实际上不需要在机器周围移动它,所以没有jar导出或类似的东西).
我只需要从Eclipse中分离执行,但由于项目有很多设置,我想自动导出脚本(可能是.sh或只是一个简单的长行).
我需要在Linux和MS-Windows平台上运行外部脚本.
exec-maven-plugin吗?我应该输入什么文件名<executable>....</executable>?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>compile-jni</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>./compile-jni</executable>
<workingDirectory>${basedir}/src/main/cpp</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)我在MakefileLinux/MS-Windows这两个平台上使用相同的功能
我的剧本compile-jni.bat:
call "%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
bash -c "make"
Run Code Online (Sandbox Code Playgroud)
我的剧本compile-jni.sh:
#!/bin/sh
make
Run Code Online (Sandbox Code Playgroud)
两位同事提出了替代方案:
使用一个变量script.extension
的变化<executable>./compile-jni${script.extension}</executable>中pom.xml
,并在命令行中添加变量mvn compile -Dscript.extention=.bat
或者在调用maven之前设置Visual Studio环境变量:
call "C:\%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
mvn compile #(the same script 'bash -c "make"' works on both platforms)
Run Code Online (Sandbox Code Playgroud)但在这两种解决方案中,Eclipse用户可能会被卡住......我仍然在寻找一种自动而优雅的解决方案......
有没有办法在新窗口中配置eclipse打开控制台应用程序而不是在运行/调试它们时自己的控制台?
我正在调试客户端/服务器应用程序,我希望一次看到两个应用程序的输出,而不必在选项卡之间切换...