Go Maven Common Commands

Source: Internet
Author: User

Mvn-v similar to javac-version or Git--version

Using MAVEN on Linux also requires setting environment variables like Java, which is
Export M2_home =/?
Export PATH = $PATH: $M 2_home/bin
Export maven_opts =-xms256m-xmx512m


About the substitution of inline Maven in MyEclipse. The path is windows-->preferences-->maven--> right click Add to replace



------------------------------------Common Commands----------------------------------------
MVN Help:system automatically created under this user ~/.m2/repository
MVN Clean Compile cleanup compilation
MVN Clean Test Cleanup tests
MVN Clean Packages
MVN clean install cleans the packaged jar into the local repository note that the local warehouse
MVN archetype:generate using archetype to build the project skeleton
MVN Clean deploy publishes items to a remote repository based on configuration information in the POM
------------------------------------Common Commands----------------------------------------


---------------------------------the MAVEN directory structure----------------------------------------
Src/main/java: Official Content pack Path
Src/mian/resources: Official configuration file path
Src/test/java: Test Package path
Src/test/resources: Test configuration file path
Src/main/webapp:war Resource Directory
---------------------------------the MAVEN directory structure----------------------------------------



----------------------------Optimize dependent commands-----------------------------------------------
MVN dependency:list shows all dependencies that have been resolved
MVN dependency:tree in the form of a directory tree to show dependence, the highest layer for a layer dependent on the next two layers dependent on three layers ....
MVN Dependency:analyze The first part shows that the second part that has been used but does not show dependencies shows that the project is not used but depends on
----------------------------Optimize dependent commands-----------------------------------------------

Widget: Jar plugin war for all dependent jars
Build: Compile Test Package release



---------------------------about the life cycle and plug-in relationship of Maven---------------------
The life cycle is the interface: it shows what to do.
Plug-ins are concrete implementations: show how to do this
---------------------------about the life cycle and plug-in relationship of Maven---------------------


Aggregation, inheritance, integration testing, automated deployment, (these pieces are very important.)





The following is a common configuration of the Pom.xml file


<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/maven-v4_0_0.xsd" >
<modelVersion>4.0.0</modelVersion> <!--fixed value in MAVEN3--
<groupId>cuiyaonan2000</groupId> <!--belong to groups--
<artifactId>maven</artifactId> <!--uniquely labeled--
<version>0.0.1-SNAPSHOT</version> <!--version number--
<packaging>war</packaging> < How to package!--items by default, jar--
Basic use of <name>maven project templates </name>
<description> The description here doesn't know what to do with </description>

<properties>
<springframework.version>2.5.6</springframework.verson>
<!--collation relies on only the <version>${springframework.version}</version> use it can
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<!--<type> dependent type, in most cases you do not have to declare the default is Jar</type>--
<scope>test</scope> <!--dependency transfer dependency See p63--
<!--<optional> tag dependency is optional do not understand the value at this point is true and false see P66</optional>-
<!--
<exclusions>
<exclusion>
To exclude transitive dependencies, just list the following 2 items.
<groupId></groupId>
<artifactId></artifactId>
</exclusion>
</exclusions>
-
</dependency>
</dependencies>




<build>
<plugins>
<!--set up the Java version of this plugin, seemingly to solve a historical problem--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<!--use UTF-8 to process resource files as follows--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>


<!--configuring the remote version Warehouse--
<repositories>
<!--set the remote repository direct-to-release version does not accept snapshot versions--
<repository>
<id>jboss</id> <!--If you use Central, you'll be covering the center warehouse--
<name>jboss repository</name>
<url>http://repository.jboss.com/maven2/</url>
<release>
<enabled>true</enabled>
<!--The following 2 parameters see p83
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
-
</release>
<snapshots>
<enabled>false</enabled>
</snapshots>
<layout>default</layout>
</repository>
</repositories>



<!--publish the project to the remote repository--
<distributionManagement>
<repository>
<id>proj-release</id> <!--Here the ID is to match the IDs of username and UserPassword in Setting.xml, and some warehouses require a rights account--
<name>proj Release repository</name>
<url>http://192.168.89.130</url>
</repository>
<snapshotRepository>
<id>proj-release</id>
<name>proj Release repository</name>
<url>http://192.168.89.130</url>
</snapshotRepository>
</distributionManagement>

</build>
</project>

Go Maven Common Commands

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.