NetBeans 6.7 版本或者更新的版本针对 Maven 支持内部构建功能。 针对之前的版本,可以在插件管理器中找到 Maven 插件。在本例中,我们使用 NetBeans 6.9 版本。
关于 NetBeans 的一些特性如下:
下面的例子将会帮助你更加充分的认识集成的 NetBeans 和 Maven 的优势。
目前为止,你已经可以在 NetBeans 里看到 Maven 工程了。看一下consumerBanking 工程的 Libraries 和 Test Libraries. 你可以发现 NetBeans 已经将 Maven 所依赖的都添加到了它的构建路径里了。
好了,我们来使用 NetBeans 的编译功能来构建这个 Maven 工程
Maven 将会开始构建该工程。你可以在 NetBeans 的终端里查看输出的 log:
NetBeans: Executing 'mvn.bat -Dnetbeans.execution=true clean install'
NetBeans: JAVA_HOME=C:Program FilesJavajdk1.6.0_21
Scanning for projects...
------------------------------------------------------------------------
Building consumerBanking
task-segment: [clean, install]
------------------------------------------------------------------------
[clean:clean]
[resources:resources]
[WARNING] Using platform encoding (Cp1252 actually)
to copy filtered resources, i.e. build is platform dependent!
skip non existing resourceDirectory C:MVNconsumerBankingsrcmainresources
[compiler:compile]
Compiling 2 source files to C:MVNconsumerBankingtargetclasses
[resources:testResources]
[WARNING] Using platform encoding (Cp1252 actually)
to copy filtered resources, i.e. build is platform dependent!
skip non existing resourceDirectory C:MVNconsumerBankingsrctestresources
[compiler:testCompile]
Compiling 1 source file to C:MVNconsumerBankingtargettest-classes
[surefire:test]
Surefire report directory: C:MVNconsumerBankingtargetsurefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.companyname.bank.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.023 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[jar:jar]
Building jar: C:MVNconsumerBankingtargetconsumerBanking-1.0-SNAPSHOT.jar
[install:install]
Installing C:MVNconsumerBankingtargetconsumerBanking-1.0-SNAPSHOT.jar
to C:UsersGB3824.m2repositorycomcompanynamebankconsumerBanking
1.0-SNAPSHOTconsumerBanking-1.0-SNAPSHOT.jar
------------------------------------------------------------------------
BUILD SUCCESSFUL
------------------------------------------------------------------------
Total time: 9 seconds
Finished at: Thu Jul 19 12:57:28 IST 2012
Final Memory: 16M/85M
------------------------------------------------------------------------
现在,右键点击 App.java 文件。选择 Run File 选项。你可以在终端看到如下结果:
NetBeans: Executing 'mvn.bat -Dexec.classpathScope=runtime
-Dexec.args=-classpath %classpath com.companyname.bank.App
-Dexec.executable=C:Program FilesJavajdk1.6.0_21binjava.exe
-Dnetbeans.execution=true process-classes
org.codehaus.mojo:exec-maven-plugin:1.1.1:exec'
NetBeans: JAVA_HOME=C:Program FilesJavajdk1.6.0_21
Scanning for projects...
------------------------------------------------------------------------
Building consumerBanking
task-segment: [process-classes,
org.codehaus.mojo:exec-maven-plugin:1.1.1:exec]
------------------------------------------------------------------------
[resources:resources]
[WARNING] Using platform encoding (Cp1252 actually)
to copy filtered resources, i.e. build is platform dependent!
skip non existing resourceDirectory C:MVNconsumerBankingsrcmainresources
[compiler:compile]
Nothing to compile - all classes are up to date
[exec:exec]
Hello World!
------------------------------------------------------------------------
BUILD SUCCESSFUL
------------------------------------------------------------------------
Total time: 1 second
Finished at: Thu Jul 19 14:18:13 IST 2012
Final Memory: 7M/64M
------------------------------------------------------------------------
什么是构建生命周期构建生命周期是一组阶段的序列(sequence of phases),每个阶段定义了目标被执行的顺序。这里的阶段是生命周...
这一章着眼于一些编写构建脚本的详细信息。Gradle 构建语言Gradle 提供一种领域特定语言或者说是 DSL,来描述构建。这种构建语言...
Gradle 在它的核心中有意地提供了一些小但有用的功能,用于在真实世界中的自动化。所有有用的功能,例如以能够编译 Java 代码为...
Redis Getbit 命令Redis 字符串(string) Redis Getbit 命令用于对 key 所储存的字符串值,获取指定偏移量上的位(bit)。语法 redi...
只要与一个事件触发器相关的事件在事件触发器所在的数据库中发生, 该事件触发器就会被引发。当前支持的事件是 ddl_command_star...