• Software--Programming--Java__Maven


    Maven 是一个构建工具,可用于编译、测试和部署 Java 项目

    采用了 管理优先配置原则。

    Maven 构建的项目的默认目录结构

         

      1 <?xml version="1.0" encoding="UTF-8"?>
      2 <project xmlns="http://maven.apache.org/POM/4.0.0"
      3          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      4          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      5     <modelVersion>4.0.0</modelVersion>
      6 
      7     <groupId>com</groupId>
      8     <artifactId>MavenApp</artifactId>
      9     <version>1.0-SNAPSHOT</version>
     10 
     11     <dependencies>
     12         <dependency>
     13             <groupId>commons-io</groupId>
     14             <artifactId>commons-io</artifactId>
     15             <version>1.4</version>
     16         </dependency>
     17         <dependency>
     18             <groupId>org.springframework</groupId>
     19             <artifactId>spring-core</artifactId>
     20             <version>3.0.0.RELEASE</version>
     21         </dependency>
     22         <dependency>
     23             <groupId>junit</groupId>
     24             <artifactId>junit</artifactId>
     25             <version>4.8.2</version>
     26             <scope>test</scope>
     27         </dependency>
     28         <dependency>
     29             <groupId>org.mockito</groupId>
     30             <artifactId>mockito-core</artifactId>
     31             <version>1.9.0</version>
     32             <scope>test</scope>
     33         </dependency>
     34     </dependencies>
     35 
     36     <build>
     37         <plugins>
     38             <plugin>
     39                 <groupId>org.apache.maven.plugins</groupId>
     40                 <artifactId>maven-compiler-plugin</artifactId>
     41                 <configuration>
     42                     <source>1.8</source>
     43                     <target>1.8</target>
     44                     <showDeprecation>true</showDeprecation>
     45                     <showWarnings>true</showWarnings>
     46                     <fork>true</fork>
     47                 </configuration>
     48             </plugin>
     49             <plugin>
     50                 <groupId>org.apache.maven.plugins</groupId>
     51                 <artifactId>maven-surefire-plugin</artifactId>
     52                 <configuration>
     53                     <excludes>
     54                         <exclude>**/*IntegrationTest.java</exclude>
     55                     </excludes>
     56                 </configuration>
     57                 <executions>
     58                     <execution>
     59                         <id>integration-test</id>
     60                         <goals>
     61                             <goal>test</goal>
     62                         </goals>
     63                         <phase>integration-test</phase>
     64                         <configuration>
     65                             <excludes>
     66                                 <exclude>none</exclude>
     67                             </excludes>
     68                         </configuration>
     69                     </execution>
     70                 </executions>
     71             </plugin>
     72             <plugin>
     73                 <artifactId>maven-assembly-plugin</artifactId>
     74                 <version>2.4</version>
     75                 <configuration>
     76                     <finalName>standalone-application</finalName>
     77                     <descriptorRefs>
     78                         <descriptorRef>jar-with-dependencies</descriptorRef>
     79                     </descriptorRefs>
     80                     <archive>
     81                         <mainfest>
     82                             <mainClass>
     83                                 com.MavenApp.MainClass
     84                             </mainClass>
     85                         </mainfest>
     86                     </archive>
     87                 </configuration>
     88                 <executions>
     89                     <execution>
     90                         <id>make-assembly</id>
     91                         <phase>package</phase>
     92                         <goals>
     93                             <goal>single</goal>
     94                         </goals>
     95                     </execution>
     96                 </executions>
     97 
     98             </plugin>
     99         </plugins>
    100     </build>
    101 
    102 
    103 </project>
    pom.xml
  • 相关阅读:
    Docker安装模拟MySQL集群
    Java中类似PHP的var_dump()
    同样的sql语句在数据库中能查出结果,但是在java springboot项目中,查不出来
    import org.junit.Test 导入失败 @Test JUnit4单元测试找不到
    解决用eclipse spring start project 自动创建项目时pom文件错误
    Laravel 队列的简单使用例子
    跨库触发器
    MySQL 主从复制 详细实例讲解 与 常见错误解决方法
    2014年末总结:对大数据处理的一点思考
    Range
  • 原文地址:https://www.cnblogs.com/masterSoul/p/8421214.html
Copyright © 2020-2023  润新知