MAVEN Series one MAVEN installation and integration with IDE

Source: Internet
Author: User

Part I: MAVEN's basic information and installation, configuration

MAVEN is a project building and management tool that provides methods to help manage builds, documentation, reporting, dependencies, SCMS, publishing, and distribution. It is easy to compile code, manage dependencies, manage binaries, and more.
The benefit of MAVEN is the ability to standardize, automate, and efficiently integrate project processes with strong scalability
With Maven itself and its plug-ins, you can also get code review reports, unit test coverage, continuous integration, and more.

The commands that Maven uses:

MAVEN Library:

http://repo2.maven.org/maven2/

Maven Dependency Query:

http://mvnrepository.com/

Maven Common commands:
1. Create a generic Java project for Maven:
MVN archetype:create
-dgroupid=packagename
-dartifactid=projectname
2. Create a MAVEN Web project:
MVN archetype:create
-dgroupid=packagename
-dartifactid=webappname
-darchetypeartifactid=maven-archetype-webapp
3. Compiling source code: MVN Compile
4. Compiling test code: MVN test-compile
5. Run the test: MVN test
6. Generate SITE:MVN Site
7. Packaging: MVN Package
8. Installing the JAR:MVN install in the local repository
9. Clear the resulting project: MVN clean
10. Build Eclipse Project: MVN eclipse:eclipse
11. Generate the Idea project: MVN Idea:idea
12. Combine with goal commands, such as package-only not tested: Mvn-dtest packages
13. Compile the content of the test: MVN test-compile
14. Only hit jar package: MVN Jar:jar
15. Test without compiling and not compiling: mvn test-skipping compile-skipping Test-compile
(-skipping's flexible use, of course, can also be used for other combination commands)
16. Clear some system settings for Eclipse: mvn Eclipse:clean

PS. General usage is the case, first through CVS or svn download code to the native, and then execute MVN eclipse:eclipse build ecllipse project file, and then import to eclipse on the line; Modify code after the MVN compile or mvn Test test, you can also download the Maven plugin for Eclipse.

Mvn-version/-v displaying version information---After the installation is complete , verify that the installation is successful
MVN archetype:generate Creating a MVN project--The default path is placed in the C drive, the user directory
MVN Archetype:create-dgroupid=com.oreilly-dartifactid=my-app Creating a MVN project

MVN package generates target directory, compiles, tests code, generates test reports, generates Jar/war files
MVN Jetty:run runs the project on jetty,
MVN Compile compilation
MVN Test compiles and tests
MVN clean empties the resulting file
MVN site to generate project-related information
mvn-dwtpversion=1.0 eclipse:eclipse Build a WTP plug-in Web project
mvn-dwtpversion=1.0 Eclipse:clean Clearing configuration information for Eclipse projects (Web project)
MVN eclipse:eclipse Convert project to eclipse project

The general order is 1.MVN clean 2.maven compile 3. Maven Package.idea and Eclipse also integrate these features and can be manipulated directly on development tools.

Maven Frame Composition:

The prerequisite is that you already have a MAVEN project.

1. Install maven1.1 Download maven,:http://maven.apache.org/download.cgi, after download successful, unzip. 1.2. Configure Environment Variablesadd D:\tools\apache-maven-3.3.9\bin to the back, with a semicolonTo test whether the installation was successful:maven catalogs can also be%m2_home%=d:\tools\apache-maven-3.3.9, new in system variables, variable =%m2_home%, value =d:\tools\apache-maven-3.3.9 add%m2_home%/bin to path paths;To test whether the installation was successful: 2. Set the local warehouse address and the IP address, i.e. settingThe default address for setting and local warehouses is C:\Users\Administrator\.m2to configure the content in setting:

In general, the parameter values in the setting can be taken from the project manager.

Part II: Integration of development tools with Maven

1.idea integration with Maven: Idea itself integrates maven plugins

The combination of 2.eclipse and maven

Installing MAVEN plugins Online

Second type of installation:Window > Preferences > Maven > installations > Add

Eclipse Configuring the path to the local warehouse and setting


Once you have completed the above steps, you can develop it.

The third part, the MAVEN project encountered in the startup problems and solutions, at present very little, encountered, follow up

error message:Exception in thread "main" java.lang.unsupportedclassversionerror:org/apache/maven/cli/mavencli:unsupported Major.minat that time did not think to write Maven blog, error message forgot, Hope forgive me. Workaround:Idea modifies the JDK version of Maven:attached: MAVEN-compatible JDK version

MAVEN Series one MAVEN installation and integration with IDE

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.