Storm record-7 Murray-Maven installation and use
Maven installation and use
Environmental preparation:
JDK1.6
Maven 3.0.4
Mveclipse8.6.1 (integrated mveclipse)
Before installing Maven, you need to make sure that JDK has been installed and configured. Maven is a project under Apache.
Download Maven http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0.4-bin.tar.gz on the official website
Decompress or rename after the download is complete
Configure the Maven environment variable:
System variable: MAVEN_HOME = D:\ server\ maven
User variable: path =% MAVEN_HOME%\ bin
Open cmd and enter: mvn-version
Mvn is a command of Maven, mvn-version is to check the version information, if you can print and publish this information, it has been successfully installed on the computer.
Modify the location of the Maven warehouse:
Find the settings.xml configuration file under conf under Maven. By default, it is under the repository directory under .m2 under the current user.
Change to D:\ Repositorys\ maven
Enter in cmd and enter to execute: mvn help:system
At this point, maven will start downloading a lot of stuff from the remote warehouse, which will have to be downloaded sooner or later.
Maven configuration to myeclipse:
Open myeclipse,Window-> Preferences-- > MyEclipse-- > Maven4MyEclipse-- > Maven
Installations remove the default and add the Maven you just installed
User Settings sets the directory of Maven's settings.xml configuration file
Maven command set:
Create a normal Java project for maven:
Mvn archetype:create
-DgroupId=packageName
-DartifactId=projectName
Create the Web project for Maven:
Mvn archetype:create
-DgroupId=packageName
-DartifactId=webappName
-DarchetypeArtifactId=mvaen-archetype-webapp
Compile source code: mvn compile
Compile test code: mvn test-compile
Run the test: mvn test
Generate site:mvn site
Packaging: mvn package
Install jar:mvn install in the local Repository
Clear the resulting project: mvn clean
Generate the eclipse project: mvn eclipse:eclipse
Production idea project: mvn idea:idea
Use goal commands in combination, such as packaging without testing: mvn-Dtest package
The content of the compilation test: mvn test-compile
Only pack jar package: mvn jar:jar
Test but not compile, and do not test compilation: mvn test- skipping compile-skipping test-compile
Clear some system settings for eclipse: mvn eclipse:clean
Download the source file of the package: mvn dependency:sources
Commonly used commands:
Mvn package
Mvn eclipse:eclipse
Mvn compile
Mvn jar:jar
Mvn clean