标签:style blog http color io os 使用 java ar
目录 |
目的 |
${basedir} |
存放 pom.xml和所有的子目录 |
${basedir}/src/main/java |
项目的 java源代码 |
${basedir}/src/main/resources |
项目的资源,比如说 property文件 |
${basedir}/src/test/java |
项目的测试类,比如说 JUnit代码 |
${basedir}/src/test/resources |
测试使用的资源 |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
mvn archetype:create 创建Maven项目 mvn archetype:create -DgroupId=idoall.org -DartifactId=helloworld -DpackageName=idoall.org 创建Maven的普通java项目,在命令行使用Maven Archetype 插件 mvn archetype:generate 创建Maven项目 mvn compile 编译源代码 mvn deploy 发布项目 mvn test -compile 编译测试源代码 mvn test 运行应用程序中的单元测试 mvn site 生成项目相关信息的网站 mvn clean 清除项目目录中的生成结果 mvn package 根据项目生成的jar mvn install 在本地Repository中安装jar mvn eclipse:eclipse 生成eclipse项目文件 mvn dependency:resolve 打印出已解决依赖的列表 mvn dependency:tree 打印整个依赖树 mvnjetty:run 启动jetty服务 mvntomcat:run 启动tomcat服务 mvn clean package -Dmaven. test .skip= true :清除以前的包后重新打包,跳过测试类 mvn install assembly:assembly 构建装配Maven Assembly 插件是一个用来创建你应用程序特有分发包的插件 mvn clean install 删除再编译 |
1
2
3
4
|
C:\Users\Administrator>java -version java version "1.8.0_20" Java(TM) SE Runtime Environment (build 1.8.0_20-b26) Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode) |
1
2
3
4
5
6
7
8
|
C:\Users\Administrator>mvn -version Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-12T04:58:1 0+08:00) Maven home: D:\toolkit\maven3.2.3\bin\.. Java version: 1.8.0_20, vendor: Oracle Corporation Java home: D:\toolkit\jdk1.8\jre Default locale: zh_CN, platform encoding: GBK OS name: "windows 8.1" , version: "6.3" , arch: "amd64" , family: "dos" <br> |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
<? xml version = "1.0" encoding = "UTF-8" ?> < settings xmlns = "http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" > <!-- 设置Maven仓库的存放位置 --> < localRepository >D:/toolkit/maven3.2.3/repo</ localRepository > < pluginGroups > </ pluginGroups > < proxies > </ proxies > < servers > </ servers > < mirrors > </ mirrors > < profiles > </ profiles > </ settings > |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
D:\_My_Project\_JAVA>mvn archetype:generate -DgroupId=idoall.org -DartifactId=idoall.org.helloworld -DpackageName=idoall.org -Dversion=1.0-SNAPSHOT ##此处省略一些提示信息 1116: remote -> org.openjdk.jmh:jmh-scala-benchmark-archetype (Generates Scala b enchmarking project, uses JMH bytecode processors) 1117: remote -> org.openjdk.jmh:jmh-simple-benchmark-archetype (Basic archetype for simple JMH-driven benchmark.) Choose a number or apply filter ( format : [groupId:]artifactId, case sensitive contains): 439: ##下面属性是我们在命令行中用 -D 选项指定的。该选项使用 -Dname=value 的格式。回车确认,就完成了项目的建立 Choose org.apache.maven.archetypes:maven-archetype-quickstart version: 1: 1.0-alpha-1 2: 1.0-alpha-2 3: 1.0-alpha-3 4: 1.0-alpha-4 5: 1.0 6: 1.1 Choose a number: 6: [INFO] Using property: groupId = idoall.org [INFO] Using property: artifactId = idoall.org.helloworld [INFO] Using property: version = 1.0-SNAPSHOT [INFO] Using property: package = idoall.org Confirm properties configuration: groupId: idoall.org artifactId: idoall.org.helloworld version: 1.0-SNAPSHOT package: idoall.org Y: : [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.1 [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: basedir, Value: D:\_My_Project\_JAVA [INFO] Parameter: package, Value: idoall.org [INFO] Parameter: groupId, Value: idoall.org [INFO] Parameter: artifactId, Value: idoall.org.helloworld [INFO] Parameter: packageName, Value: idoall.org [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] project created from Old (1.x) Archetype in dir : D:\_My_Project\_JAVA\ido all.org.helloworld [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time : 36.771 s [INFO] Finished at: 2014-09-11T14:22:28+08:00 [INFO] Final Memory: 14M /155M [INFO] ------------------------------------------------------------------------ |
1
2
3
4
5
6
7
8
9
10
11
12
|
package idoall.org; /** * Hello world! * */ public class App { public static void main( String[] args ) { System.out.println( "Hello World!" ); } } |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
D:\_My_Project\_JAVA\idoall.org.helloworld>mvn package [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building idoall.org.helloworld 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ Downloading: https: //repo .maven.apache.org /maven2/org/apache/maven/plugins/maven -resources-plugin /2 .6 /maven-resources-plugin-2 .6.pom Downloaded: https: //repo .maven.apache.org /maven2/org/apache/maven/plugins/maven- resources-plugin /2 .6 /maven-resources-plugin-2 .6.pom (8 KB at 5.4 KB /sec ) Downloading: https: //repo .maven.apache.org /maven2/org/apache/maven/plugins/maven ...... ##此处省略很多下载信息,只列出重要的成功信息,可以看到building成功后的目录 [INFO] Building jar: D:\_My_Project\_JAVA\idoall.org.helloworld\target\idoall.org.helloworld-1.0-SNAPSHOT.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time : 01:51 min [INFO] Finished at: 2014-09-11T14:29:24+08:00 [INFO] Final Memory: 17M /114M [INFO] ------------------------------------------------------------------------ |
1
2
|
D:\_My_Project\_JAVA\idoall.org.helloworld>java - cp target /idoall .org.helloworld -1.0-SNAPSHOT.jar idoall.org.App Hello World! |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<? xml version = "1.0" encoding = "utf-8" ?> < 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 >idoall.org</ groupId > < artifactId >idoall.org.helloworld</ artifactId > < version >1.0-SNAPSHOT</ version > < packaging >jar</ packaging > < name >idoall.org.helloworld</ 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 > |
maven3.2.3+eclipse4.4+JDK1.8+win8.1_64bit环境搭建
标签:style blog http color io os 使用 java ar
原文地址:http://www.cnblogs.com/lion.net/p/3967034.html