创建maven工程

创建maven工程:

  

 

 

 

 

 

 

 

 想要在一个项目中加另外一个项目,就要创建model,不能新建项目!!!

pom.xml是maven的配置文件,内容的具体介绍如下:

<?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>com.itheima</groupId>
  <artifactId>day35_javase_02</artifactId>
  <version>1.0-RELEASE</version>
  <!--该项目的打包方式,默认为jar-->
  <packaging>jar</packaging>

  <name>day35_javase_02</name>
  <!-- FIXME change it to the project's website -->
  <url>http://www.example.com</url>

  <!--
    项目的一些属性配置
    <project.build.sourceEncoding> 项目构建时候的字符集
    <maven.compiler.source> 编译的源码的jdk版本
    <maven.compiler.target> 编译的目标文件的jdk版本
  -->
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <distributionManagement>
  <!--配置要部署到的私服仓库的路径-->
  <repository>
    <id>releases</id>
    <url>http://localhost:8081/nexus/content/repositories/releases/</url>
  </repository>

  <snapshotRepository>
    <id>snapshots</id>
    <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
  </snapshotRepository>
</distributionManagement>

  <!--
    该项目引入的所有依赖都写在dependencies里面
  -->
  <dependencies>

    <!--
      每一个dependency标签就负责引入一个依赖
    -->
    <dependency>
      <!--
        groupId 坐标的组织名
        artifactId 坐标的项目名
        version 坐标的版本号

        scope 依赖的使用范围,如果为test就表示只能在test里面的java里面使用
      -->
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <!--
        插件添加在
    -->
    <build>
        <plugins>
            <!--jdk编译插件-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>utf-8</encoding>
                </configuration>
            </plugin>


            <!--引入tomcat7的插件-->
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <!--端口号-->
                    <port>8833</port>
                    <!--path就相当于部署项目时候的ContextPath-->
                    <path>/</path>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

 

 项目的组成部分:

 

 

 

 

 

 

posted @ 2021-01-03 03:31  极地阳光-ing  阅读(138)  评论(0编辑  收藏  举报