Method 1:
1. Use:
MVN archetype:generate
Then enter the relevant configuration as required:
(1) You can skip filter:
Choose a number or Apply filter (format: [Groupid:]artifactid, Case sensitive contains): 777:
(2) then enter as required:
A. Version number
B.GroupId
C : Artifactid
D: version
e: Package : Can skip
F:y: Confirm
Recording:
Choose a number or Apply filter (format: [Groupid:]artifactid, Case sensitive contains): 777:choose Org.apache.maven.arche Types:maven-archetype-quickstart Version:1:1.0-alpha-12:1.0-alpha-23:1.0-alpha-34:1.0-alpha-45:1.06:1.1choose A Number:6:6Define value for property ' GroupId ':: Org.xubo.maven.testDefine value of ' Artifactid ':: maven_ch2d Efine value for property ' version ': 1.0-snapshot:: 0.0.1-snapshotdefine value of ' package ': Org.xubo.maven.test:: Confirm properties Configuration:groupId:org.xubo.maven.testartifactId:maven_ch2version: 0.0.1-snapshotpackage:org.xubo.maven.test y:: Y
(3) Then MAVEN generates the appropriate project
Pom.xml:
<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>org.xubo.maven.test</groupId> <artifactId> Maven_ch2</artifactid> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging > <name>maven_ch2</name> <url>http://maven.apache.org</url> <properties> < Project.build.sourceencoding>utf-8</project.build.sourceencoding> </properties> <dependencies > <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies>< ;/project>
2. Then go to project to test
<pre name= "code" class= "plain" >D:\ALL\IDEA\MAVENTEST\MAVEN_CH2>MVN test[info] scanning for projects ... [INFO] [INFO]------------------------------------------------------------------------[INFO] Building MAVEN_CH2 0.0.1- Snapshot[info]------------------------------------------------------------------------[Info][info]--- Maven-resources-plugin:2.6:resources (default-resources) @ maven_ch2---[INFO] Using ' UTF-8 ' encoding to copy filtered Resources. [INFO] Skip non existing resourcedirectory D:\all\idea\maventest\maven_ch2\src\main\resources[info][info]--- Maven-compiler-plugin:3.1:compile (default-compile) @ maven_ch2---[INFO] changes detected-recompiling the module! [INFO] Compiling 1 source file to D:\all\idea\maventest\maven_ch2\target\classes[info][info]---maven-resources-plugin:2.6: Testresources (default-testresources) @ maven_ch2---[INFO] Using ' UTF-8 ' encoding to copy filtered resources. [INFO] Skip non existing resourcedirectory D:\all\idea\mavenTest\maven_ch2\src\tEst\resources[info][info]---maven-compiler-plugin:3.1:testcompile (default-testcompile) @ maven_ch2---[INFO] Changes detected-recompiling the module! [INFO] Compiling 1 source file to D:\all\idea\maventest\maven_ch2\target\test-classes[info][info]---maven-surefire-plugin : 2.12.4:test (default-test) @ maven_ch2---[INFO] Surefire report Directory:d:\all\idea\maventest\maven_ch2\target\ Surefire-reports-------------------------------------------------------t E S t S-------------------------------------------------------Running org.xubo.maven.test.AppTestTests run:1, failures: 0, errors:0, skipped:0, Time elapsed:0.007 secresults:tests run:1, failures:0, errors:0, Skipped:0[info]--------- ---------------------------------------------------------------[INFO] BUILD Success[info]----------------------- -------------------------------------------------[INFO] Total time:3.034 s[info] finished at:2016-05-09t18:08:00+ 08:00[info] Final Memory:13m/162m[info]------------------------------------------------------------------------
The first test needs to download a lot of dependent packages
3.package:
MVN Package
Generated:
Maven_ch2-0.0.1-snapshot.jar
Packages after the package are not local and require an install
MVN Install
At this time, you can find the corresponding jar packages and pom.xml files and update records in the local repository.
Method 2: No success
MVN Archetype:generate-dgroupid=org.xubo.maven.learning-dartifactid=maven_ch3 Dversion=0.0.1-snapshot
Reference:
"1" http://www.cnblogs.com/buhaiqing/archive/2012/11/04/2754187.html
"2" http://blog.csdn.net/zgmzyr/article/details/6931957
Maven Learning 2 using archetype to quickly build a new project