zoukankan      html  css  js  c++  java
  • Maven技术 基础

    一、配置基本信息

    1. 装maven解压到一个目录下,在eclipse中配置解压好的目录

    2. 配置settings.xml文件:

     

    3. settings.xml中需要配置的内容:

    <!-- 本地仓库地址 -->
    <localRepository>E:/apache-maven-3.3.3/repository</localRepository>
         
    <!-- 阿里云镜像,比国外的下载快 -->
     <mirror>
            <id>alimaven</id>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
            <mirrorOf>central</mirrorOf>
     </mirror>
    <!-- 配置JDK版本 -->
    <profile>
                <id>jdk-10</id>
                <activation>
                    <activeByDefault>true</activeByDefault>
                    <jdk>10</jdk>
                </activation>
                <properties>
                    <maven.compiler.source>10</maven.compiler.source>
                    <maven.compiler.target>10</maven.compiler.target>
                    <maven.compiler.compilerVersion>10</maven.compiler.compilerVersion>
                </properties>
        </profile>
        

    二、创建maven项目

    1. pom.xml配置文件中配置依赖的项目或jar包

    例:配置spring-webmvc  jar包:可以在https://mvnrepository.com/ 中查找groupId , artifactId , version 

      <dependencies>
          <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.3.9.RELEASE</version>
        </dependency>
      </dependencies>
      

    例:配置所依赖的项目

         <dependencies>
              <dependency>
                  <groupId>com.caijava</groupId>
                  <artifactId>maven1</artifactId>
                  <version>0.0.1-SNAPSHOT</version>
              </dependency>
          </dependencies>

    2. 创建pom项目(父项目)

    properties 标签的子标签是自定义的,定义之后可以用${ names }来获取值

    dependencyManagement 标签声明可能要用到的jar包,需要在子项目中配置groupId 和 artifactId 才能使用,不用配置version ,该标签可以起到管理jar 包版本的作用

      <properties>
          <spring-version>4.3.9.RELEASE</spring-version>
      </properties>
      <dependencyManagement>
          <dependencies>
              <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring-version}</version>
            </dependency>
      </dependencies>

    3.创建子项目:

    <dependencies>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
            </dependency>
        </dependencies>

     三、创建web项目:

     

  • 相关阅读:
    P4014 分配问题 网络流
    P4015 运输问题 网络流问题
    P4013 数字梯形问题 网络流
    网络流 P2770 航空路线问题
    网络流之最小费用最大流 P1251 餐巾计划问题
    二分图定理
    数论 C
    网络流 E
    网络流 之 P2766 最长不下降子序列问题
    scp使用
  • 原文地址:https://www.cnblogs.com/lastingjava/p/10170972.html
Copyright © 2011-2022 走看看