Develop a project of your own, build Dynamic Web project, the result of submitting code to the operational personnel when they request to use the MAVEN project, said this better management. It's a shame I used to have too little maven, so learn.
1. Convert Project type
Right-click item and see the Configure option, direct convert to Maven project, the entire project directory will change, as shown
With more MAVEN's iconic file Pom.xml, the edit box pops up as follows
OK, the MAVEN project has been converted, here you can edit your version, artifact ID and other information.
2. Editor Pom.xml
Click on the pom.xml below to enter the POM edit mode.
In a normal project we just need to add some dependencies, and we can go to http://www.mvnrepository.com/to find the dependent packages.
From the project's referenced libraries subdirectory can see their own dependencies, such as my project needs Mahout package, then I go to the site search mahout, according to their own needs of the package and version, into the following page.
You can see the dependency of an XML markup language and copy this into your pom.xml. Here is my pom.xml section of code.
<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi: schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > < Modelversion>4.0.0</modelversion> <groupId>SmartPush</groupId> <artifactid>smartpush </artifactId> <packaging>war</packaging> <dependencies> <dependency> <groupid> ;org.apache.mahout</groupid> <artifactId>mahout-core</artifactId> <version>0.9</ version> </dependency> <dependency> <groupId>org.apache.mahout</groupId> <artifact id>mahout-math</artifactid> <version>0.9</version> </dependency> <dependency> & Lt;groupid>mysql</groupid> <artifactId>mysql-connector-java</artifactId> <version> 5.1.30</version> </dependency> <dependency> <groupid>log4j</groupid> <artifactId>log4j</artifactId> <version>1.2.17</version> &L t;/dependency> </dependencies> <build> <sourceDirectory>src</sourceDirectory> <reso urces> <resource> <directory>src</directory> <excludes> <exclude>**/*.jav
a</exclude> </excludes> </resource> </resources> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration&
Gt <source>1.7</source> <target>1.7</target> </configuration> </plugin> &L t;plugin> <artifactId>maven-war-plugin</artifactId> <version>2.3</version> <conf Iguration> <warSourceDirectory>WebContent</warSourceDirectory> <FAILONMISSINGWEBXML>FALSE&L T;/failonmissingwebxml> </configuration> </plugin> </plugins> </build> <version>0.0.1</versio N> </project>
3. Compile
Go to your own project directory and execute the following command
$MVN Compile
$MVN Package
You can see the required war file in the target directory.