- 论坛徽章:
- 0
|
前面写了一些对mvn的介绍,此处就不再对此多说了。这里只是写一点如何在netBeans中用mvn来管理项目。
要使用mvn,我们首先要建一个mvn项目,比如:
shell>mvn archetype:create -DgroupId=cn.edu.sdau.neat -DartifactId=netbeansproject -DarchetypeArtifactId=maven-archetype-quickstart
这样我们会建一个简单的HelloWord实例。然后再将mvn项目同时转为netBeans能找到的项目:
shell>mvn netbeans-freeform:generate-netbeans-project
这样会在我们的项目目录下建一个nbproject的文件夹,里面是nb的一些必要信息。
- The
file is the Netbeans Freeform project descriptor. - The mavencall.xml
holds the Ant calls which execute Maven 2, as Netbeans uses Ant as its build tool. - The project.properties
files holds the two properties: local.repository
which is the absolute path to the Maven 2 local repository and project.directory
which is the absolute path to the project directory. 现在我们用netBeans打开,就可以在netBeans中编辑项目了。
如果你用netBeans编辑,然后在编译它,也许会提示你找不到${mvn.path},此时你需要做如下工作来解决这个问题:
Tools -> Options -> Ant 在Properties里加入:
mvn.path=mvn
然后在使用nb编译运行应该就都没有问题了。
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/30752/showart_433117.html |
|