saltfish666 / fileCloud

0 stars 0 forks source link

Maven #9

Open saltfish666 opened 6 years ago

saltfish666 commented 6 years ago

安装配置 https://www.jianshu.com/p/191685a33786 https://www.bilibili.com/video/av13740014?spm_id_from=333.338.__bofqi.12

saltfish666 commented 6 years ago

$ mvn -v Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-25T03:49:05+08:00) Maven home: /Users/apple/Downloads/apache-maven-3.5.3 Java version: 10, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home Default locale: en_CN, platform encoding: UTF-8 OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"

最烦这种命令行名称和产品名称不一致的。

saltfish666 commented 6 years ago

$ pwd /Users/apple/Downloads/apache-maven-3.5.3 $ tree -L 1 . ├── LICENSE ├── NOTICE ├── README.txt ├── bin ├── boot ├── conf └── lib

$ export declare -x JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home" declare -x M2_HOME="/Users/apple/Downloads/apache-maven-3.5.3"

saltfish666 commented 6 years ago

核心概念

saltfish666 commented 6 years ago

$ ls ant commons-validator antlr dom4j aopalliance geronimo-spec asm io avalon-framework javax backport-util-concurrent jaxen ch jdom classworlds junit clojure-complete log4j com logkit commons-beanutils net commons-chain org commons-cli oro commons-codec regexp commons-collections sslext commons-digester xerces commons-io xml-apis commons-lang xpp3 commons-logging

$ pwd /Users/apple/.m2/repository

这就是默认仓库

saltfish666 commented 6 years ago

https://blog.csdn.net/u012152619/article/details/51485297

pom 文件

saltfish666 commented 6 years ago

假设有pom文件:

org.springframework spring-beans ${spring.version}
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aspects</artifactId>
        <version>${spring.version}</version>
    </dependency>

删除厂库中的 org.springframe 在执行maven install 可以看到有重行下载了。

saltfish666 commented 6 years ago

假设有pom文件:

org.springframework spring-beans ${spring.version}
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aspects</artifactId>
        <version>${spring.version}</version>
    </dependency>

删除厂库中的 org.springframe 在执行maven install 可以看到有重行下载了。

saltfish666 commented 6 years ago
com.learnmvn animal.Cat 0.0.1-SNAPSHOT

所谓的坐标就是唬人的, 观察下Spring框架需要引入的jar包,你会发现, 只要给一个名字就行了,但是名字一般分为三个部分 大名称,小名称,版本号,文件类型。。