Maven学习之路(一):POM文件

2018-07-22  本文已影响0人  ShannonAJ

基本概念

POM(Project Object Model,项目对象模型)文件是Maven项目的核心,定义项目基本信息,描述如何构建,声明依赖

第一个pom.xml

<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.shannonAJ.mavenStudy</groupId>
    <artifactId>hello-maven</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>Maven study project</name>
</project>




编写代码


package com.shannonAJ.maven-study.hello-maven;

public class HelloMaven
{
    public String sayHello()
    {
        return "Hello Maven";
    }

    public static void main(String[] args) {
        System.out.println(new HelloMaven().sayHello());
    }

}

E:\Development\workspace\java-project\hello-maven>mvn clean compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven study project 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ hello-maven ---
[INFO] Deleting E:\Development\workspace\java-project\hello-maven\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hello-maven ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\Development\workspace\java-project\hello-maven\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ hello-maven ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 1 source file to E:\Development\workspace\java-project\hello-maven\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.156 s
[INFO] Finished at: 2018-07-21T21:22:34+08:00
[INFO] Final Memory: 13M/165M
[INFO] ------------------------------------------------------------------------

编写测试代码

<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.shannonAJ.mavenStudy</groupId>
    <artifactId>hello-maven</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>Maven study project</name>
    
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    
</project>




package com.shannonAJ.studyMaven.helloMaven;

import static org.junit.Assert.assertEquals;
import org.junit.Test;

public class HelloMavenTest
{
    @Test
    public void testSayHello() {
        HelloMaven hm = new HelloMaven();
        String res = hm.sayHello();
        assertEquals(""Hello Maven", res);
    }
    
}


E:\Development\workspace\java-project\hello-maven>mvn clean test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven study project 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ hello-maven ---
[INFO] Deleting E:\Development\workspace\java-project\hello-maven\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hello-maven ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\Development\workspace\java-project\hello-maven\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ hello-maven ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 1 source file to E:\Development\workspace\java-project\hello-maven\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hello-maven ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\Development\workspace\java-project\hello-maven\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ hello-maven ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 1 source file to E:\Development\workspace\java-project\hello-maven\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ hello-maven ---
[INFO] Surefire report directory: E:\Development\workspace\java-project\hello-maven\target\surefire-reports
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.pom (2.4 kB at 7.6 kB/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/surefire-providers/2.12.4/surefire-providers-2.12.4.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/surefire-providers/2.12.4/surefire-providers-2.12.4.pom (2.3 kB at 9.8 kB/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.jar
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.jar (37 kB at 145 kB/s)

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.shannonAJ.studyMaven.helloMaven.HelloMavenTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.062 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.891 s
[INFO] Finished at: 2018-07-22T10:37:31+08:00
[INFO] Final Memory: 20M/209M
[INFO] ------------------------------------------------------------------------




打包和运行

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven study project 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ hello-maven ---
[INFO] Deleting E:\Development\workspace\java-project\hello-maven\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hello-maven ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\Development\workspace\java-project\hello-maven\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ hello-maven ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 1 source file to E:\Development\workspace\java-project\hello-maven\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hello-maven ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\Development\workspace\java-project\hello-maven\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ hello-maven ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 1 source file to E:\Development\workspace\java-project\hello-maven\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ hello-maven ---
[INFO] Surefire report directory: E:\Development\workspace\java-project\hello-maven\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.shannonAJ.studyMaven.helloMaven.HelloMavenTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.042 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hello-maven ---
[INFO] Building jar: E:\Development\workspace\java-project\hello-maven\target\hello-maven-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.476 s
[INFO] Finished at: 2018-07-22T18:11:18+08:00
[INFO] Final Memory: 17M/165M
[INFO] ------------------------------------------------------------------------



E:\Development\workspace\java-project\hello-maven>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven study project 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ hello-maven ---
[INFO] Deleting E:\Development\workspace\java-project\hello-maven\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hello-maven ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\Development\workspace\java-project\hello-maven\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ hello-maven ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 1 source file to E:\Development\workspace\java-project\hello-maven\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hello-maven ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\Development\workspace\java-project\hello-maven\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ hello-maven ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 1 source file to E:\Development\workspace\java-project\hello-maven\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ hello-maven ---
[INFO] Surefire report directory: E:\Development\workspace\java-project\hello-maven\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.shannonAJ.studyMaven.helloMaven.HelloMavenTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hello-maven ---
[INFO] Building jar: E:\Development\workspace\java-project\hello-maven\target\hello-maven-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ hello-maven ---
[INFO] Installing E:\Development\workspace\java-project\hello-maven\target\hello-maven-1.0-SNAPSHOT.jar to E:\Development\m2\localRepository\com\shannonAJ\mavenStudy\hello-maven\1.0-SNAPSHOT\hello-maven-1.0-SNAPSHOT.jar
[INFO] Installing E:\Development\workspace\java-project\hello-maven\pom.xml to E:\Development\m2\localRepository\com\shannonAJ\mavenStudy\hello-maven\1.0-SNAPSHOT\hello-maven-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.707 s
[INFO] Finished at: 2018-07-22T18:19:01+08:00
[INFO] Final Memory: 17M/170M
[INFO] ------------------------------------------------------------------------



生成可执行的jar文件

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: andy-
Created-By: Apache Maven 3.5.0
Build-Jdk: 1.8.0_131



<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>com.shannonAJ.mavenStudy.helloMaven.HelloMaven</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>



E:\Development\workspace\java-project\hello-maven>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven study project 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-shade-plugin/2.4.3/maven-shade-plugin-2.4.3.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-shade-plugin/2.4.3/maven-shade-plugin-2.4.3.pom (8.5 kB at 23 kB/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-shade-plugin/2.4.3/maven-shade-plugin-2.4.3.jar
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-shade-plugin/2.4.3/maven-shade-plugin-2.4.3.jar (104 kB at 640 kB/s)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ hello-maven ---
[INFO] Deleting E:\Development\workspace\java-project\hello-maven\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hello-maven ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\Development\workspace\java-project\hello-maven\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ hello-maven ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 1 source file to E:\Development\workspace\java-project\hello-maven\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hello-maven ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\Development\workspace\java-project\hello-maven\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ hello-maven ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 1 source file to E:\Development\workspace\java-project\hello-maven\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ hello-maven ---
[INFO] Surefire report directory: E:\Development\workspace\java-project\hello-maven\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.shannonAJ.studyMaven.helloMaven.HelloMavenTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hello-maven ---
[INFO] Building jar: E:\Development\workspace\java-project\hello-maven\target\hello-maven-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-shade-plugin:2.4.3:shade (default) @ hello-maven ---
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/maven-compat/3.0/maven-compat-3.0.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/maven-compat/3.0/maven-compat-3.0.pom (4.0 kB at 14 kB/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/wagon/wagon-provider-api/1.0-beta-6/wagon-provider-api-1.0-beta-6.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/wagon/wagon-provider-api/1.0-beta-6/wagon-provider-api-1.0-beta-6.pom (1.8 kB at 13 kB/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/wagon/wagon/1.0-beta-6/wagon-1.0-beta-6.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/wagon/wagon/1.0-beta-6/wagon-1.0-beta-6.pom (12 kB at 31 kB/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/jdom/jdom/1.1/jdom-1.1.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/jdom/jdom/1.1/jdom-1.1.pom (0 B at 0 B/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.pom (0 B at 0 B/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/shared/maven-shared-components/20/maven-shared-components-20.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/shared/maven-shared-components/20/maven-shared-components-20.pom (0 B at 0 B/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/vafer/jdependency/1.1/jdependency-1.1.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/vafer/jdependency/1.1/jdependency-1.1.pom (0 B at 0 B/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm/5.0.4/asm-5.0.4.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm/5.0.4/asm-5.0.4.pom (0 B at 0 B/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-parent/5.0.4/asm-parent-5.0.4.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-parent/5.0.4/asm-parent-5.0.4.pom (0 B at 0 B/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-analysis/5.0.4/asm-analysis-5.0.4.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-analysis/5.0.4/asm-analysis-5.0.4.pom (0 B at 0 B/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-tree/5.0.4/asm-tree-5.0.4.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-tree/5.0.4/asm-tree-5.0.4.pom (0 B at 0 B/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-commons/5.0.4/asm-commons-5.0.4.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-commons/5.0.4/asm-commons-5.0.4.pom (0 B at 0 B/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-util/5.0.4/asm-util-5.0.4.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-util/5.0.4/asm-util-5.0.4.pom (0 B at 0 B/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/maven-compat/3.0/maven-compat-3.0.jar
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/wagon/wagon-provider-api/1.0-beta-6/wagon-provider-api-1.0-beta-6.jar
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/jdom/jdom/1.1/jdom-1.1.jar
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/jdom/jdom/1.1/jdom-1.1.jar (0 B at 0 B/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/vafer/jdependency/1.1/jdependency-1.1.jar
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar (0 B at 0 B/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-analysis/5.0.4/asm-analysis-5.0.4.jar
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/vafer/jdependency/1.1/jdependency-1.1.jar (0 B at 0 B/s)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-util/5.0.4/asm-util-5.0.4.jar
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-analysis/5.0.4/asm-analysis-5.0.4.jar (0 B at 0 B/s)
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/wagon/wagon-provider-api/1.0-beta-6/wagon-provider-api-1.0-beta-6.jar (53 kB at 145 kB/s)
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar (245 kB at 580 kB/s)
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-util/5.0.4/asm-util-5.0.4.jar (0 B at 0 B/s)
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/maven-compat/3.0/maven-compat-3.0.jar (285 kB at 650 kB/s)
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing E:\Development\workspace\java-project\hello-maven\target\hello-maven-1.0-SNAPSHOT.jar with E:\Development\workspace\java-project\hello-maven\target\hello-maven-1.0-SNAPSHOT-shaded.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ hello-maven ---
[INFO] Installing E:\Development\workspace\java-project\hello-maven\target\hello-maven-1.0-SNAPSHOT.jar to E:\Development\m2\localRepository\com\shannonAJ\mavenStudy\hello-maven\1.0-SNAPSHOT\hello-maven-1.0-SNAPSHOT.jar
[INFO] Installing E:\Development\workspace\java-project\hello-maven\pom.xml to E:\Development\m2\localRepository\com\shannonAJ\mavenStudy\hello-maven\1.0-SNAPSHOT\hello-maven-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.700 s
[INFO] Finished at: 2018-07-22T18:54:54+08:00
[INFO] Final Memory: 21M/173M
[INFO] ------------------------------------------------------------------------




 E:\Development\workspace\java-project\hello-maven\target 的目录

2018/07/22  18:54    <DIR>          .
2018/07/22  18:54    <DIR>          ..
2018/07/22  18:54    <DIR>          classes
2018/07/22  18:54             3,160 hello-maven-1.0-SNAPSHOT.jar
2018/07/22  18:54    <DIR>          maven-archiver
2018/07/22  18:54    <DIR>          maven-status
2018/07/22  18:54             2,906 original-hello-maven-1.0-SNAPSHOT.jar
2018/07/22  18:54    <DIR>          surefire-reports
2018/07/22  18:54    <DIR>          test-classes
               2 个文件          6,066 字节
               7 个目录 231,469,121,536 可用字节

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: andy-
Created-By: Apache Maven 3.5.0
Build-Jdk: 1.8.0_131
Main-Class: com.shannonAJ.mavenStudy.helloMaven.HelloMaven

E:\Development\workspace\java-project\hello-maven>java -jar target\hello-maven-1.0-SNAPSHOT.jar
Hello Maven

小结

参考资料

《Maven实战》
作者:许晓斌
京东链接: https://item.jd.com/10476794.html

上一篇 下一篇

猜你喜欢

热点阅读