在Netbeans中运行Maven项目

时间:2013-05-03 14:37:55

标签: java maven netbeans

有没有办法在Netbeans中以Maven方式运行Maven项目? Netbeans会自动执行,但我只是想正常运行程序,作为典型的Java项目(以节省时间)。我希望输出看起来像这样:

run:
Hello world!
BUILD SUCCESSFUL (total time: 0 seconds)

而不是:

cd C:\Users\mbrnw_000\Documents\NetBeansProjects\mavenproject1; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.7.0_15" "\"C:\\Program Files\\NetBeans 7.3\\java\\maven\\bin\\mvn.bat\"" "-Dexec.args=-classpath %classpath pl.mbrnwsk.mavenproject1.App" "-Dexec.executable=C:\\Program Files\\Java\\jdk1.7.0_15\\bin\\java.exe" process-classes org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
Scanning for projects...

------------------------------------------------------------------------
Building mavenproject1 1.0-SNAPSHOT
------------------------------------------------------------------------

[resources:resources]
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory C:\Users\mbrnw_000\Documents\NetBeansProjects\mavenproject1\src\main\resources

[compiler:compile]
Nothing to compile - all classes are up to date

[exec:exec]
Hello world!
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 1.143s
Finished at: Fri May 03 16:27:09 CEST 2013
Final Memory: 6M/107M
------------------------------------------------------------------------

1 个答案:

答案 0 :(得分:0)

在项目属性中启用“保存时编译”。但请注意,在7.4(即将推出的版本)中,所有执行都将由Maven专门完成。