This article mainly introduces the construction and idea configuration of the Maven environment. It is shared with you. The details are as follows:
Maven download: http://maven.apache.org/download.cgi
Maven Central Warehouse Address: http://search.maven.org
Configure maven environment variables
M2_HOME: D:/workspace/maven/apache-maven-3.0.5
Path:;%M2_HOME%/bin;
Check whether it is successful and open CMD:
Mvn -v
mvn install will install the generated components of the project to the local Maven repository
mvn deploy is used to distribute the generated artifacts of the project to the remote Maven repository
D:/>mvn archetype:generate: build maven standard project directory structure on D: disk
2. Settings.xml file configuration
2.0 Modify the local repository location
conf/settings.xml in the M2_home directory
<localRepository>D:/workspace/maven/stone</localRepository>
2.1 How to configure remote repository (private server): (nexus-2.0.4-1-bundle)
<profiles> <profile> <id>nexus</id> <repositories><!--Configure remote repository--> <repository> <id>nexus</id> <name>Central Repository</name> <url>http://127.0.0.1/nexus/content/groups/public</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled><!-----> </snapshots> </repository> </repository> </repository> </repository> <pluginRepository> <id>nexus</id> <name>Central Repository</name> <url>http://127.0.0.1/nexus/content/groups/public</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepository> </profile> </profiles> <activeProfiles><!--Activate Remote Repository--> <activeProfile>nexus</activeProfile> </activeProfiles>
2.2 You can also configure the image download of the repository
<mirrors> <mirror><!--Configuration Mirror--> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://127.0.0.1/nexus/content/groups/public</url> </mirror> </mirrors>
3. pom.xml file configuration dependency
<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> <groupId>xu.feifei</groupId> <artifactId>feifei</artifactId> <packaging>war</packaging> <version>1.0</version> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20090211</version> </dependency> </dependencies> <build> <finalName>feifei</finalName> </build> </project>
2. IDEA construction Maven-related configuration
.
The package structure of the maven project
Set up maven automatic packet guidance
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.