pom.xml常用配置
1. 开头配置
<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.myapp</groupId>
<artifactId>mvn-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging><!-- jar | war -->
<name>mvn-test 1.0</name>
....
2. properties 配置
<properties>
<!-- 源文件的编码 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- 后面引用 -->
<spring.version>3.0.0.RELEASE</spring.version>
</properties>
3. dependency配置
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
</dependencies>
4. build plugin配置
<build>
<plugins>
<plugin>
<!-- 设置javac编译器的版本和编码字符 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>utf8</encoding><!-- 编译器编码 -->
</configuration>
</plugin>
<plugin>
<!-- 设置jar包运行主类 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.myapp.springmvc.Run</mainClass><!-- jar包运行主类 -->
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- 使用ant -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<!-- 复制 -->
<id>conf</id>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo message="copy conf" />
<copy
file="D:\study\workspace\springmvc\conf\settings.ini"
tofile="D:\study\workspace\springmvc\target\conf\settings.ini"
overwrite="true" encoding="utf8" />
<echo message="copy lang" />
<copy
toDir="D:\study\workspace\springmvc\target\lang"
overwrite="true" encoding="utf8">
<fileset
dir="D:\study\workspace\springmvc\lang" />
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- 复制文件 -->
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes</outputDirectory>
<resources>
<resource>
<directory>profiles/prod</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
分享到:
相关推荐
mvn常用命令,平时使用比较多的,相信会很要帮助。
maven常用命令 配置maven 环境变量配置
-D传入属性参数-P使用pom中指定的配置-e显示maven运行出错的信息-o离线执行命令,即不去远程仓库更新包-X显示maven允许的debug信息-U强制去远程参考更新snapshot包例如mvninstall-Dmaven.test.skip=true-Poracle其他...
demo参考网上资料,使用mvn建项,使用者需要有一定mvn基础。 demo没有实现复杂业务,只实现了部分功能: 微服务模块初始化时,常量和数据库信息等使用云配置服务(spring config)获取; 微服务之间使用负载均衡...
conf目录为配置目录,你可以在里面进行maven的配置 lib包存储着maven的依赖,因为maven自己也是java构建的 复制当前的目录(注:最好不要有中文) 右键此电脑-->属性-->高级系统设置-->环境变量 添加一个新的环境...
Java EE常用框架 WebService 介绍 基于Web的服务。它使用Web(HTTP)方式,接收和响应外部系统的某种请求。从而实现远程调用 术语 XML. Extensible Markup Language -扩展性标记语言 WSDL – ...
将下载的压缩包解压到开发工具常用的目录,例如D:\developer\apache-maven-3.9.1-bin。 配置系统环境变量。在Windows系统中,进入“高级系统设置”,点击“环境变量”。在“系统变量”中编辑Path,添加Maven的bin...
将下载的压缩包解压到开发工具常用的目录,例如D:\developer\apache-maven-3.9.1-bin。 配置系统环境变量。在Windows系统中,进入“高级系统设置”,点击“环境变量”。在“系统变量”中编辑Path,添加Maven的bin...
将下载的压缩包解压到开发工具常用的目录,例如D:\developer\apache-maven-3.9.1-bin。 配置系统环境变量。在Windows系统中,进入“高级系统设置”,点击“环境变量”。在“系统变量”中编辑Path,添加Maven的bin...
主要记录Maven项目管理工具的常用命令,生命周期,概念模型,Maven私服安装,上传本地资源到私服,从私服下载资源,安装第三方jar包到本地仓库,安装第三方jar包到私服,希望学习maven的朋友进行交流!
将下载的压缩包解压到开发工具常用的目录,例如D:\developer\apache-maven-3.9.1-bin。 配置系统环境变量。在Windows系统中,进入“高级系统设置”,点击“环境变量”。在“系统变量”中编辑Path,添加Maven的bin...
将下载的压缩包解压到开发工具常用的目录,例如D:\developer\apache-maven-3.9.1-bin。 配置系统环境变量。在Windows系统中,进入“高级系统设置”,点击“环境变量”。在“系统变量”中编辑Path,添加Maven的bin...
将下载的压缩包解压到开发工具常用的目录,例如D:\developer\apache-maven-3.9.1-bin。 配置系统环境变量。在Windows系统中,进入“高级系统设置”,点击“环境变量”。在“系统变量”中编辑Path,添加Maven的bin...
将下载的压缩包解压到开发工具常用的目录,例如D:\developer\apache-maven-3.9.1-bin。 配置系统环境变量。在Windows系统中,进入“高级系统设置”,点击“环境变量”。在“系统变量”中编辑Path,添加Maven的bin...
将下载的压缩包解压到开发工具常用的目录,例如D:\developer\apache-maven-3.9.1-bin。 配置系统环境变量。在Windows系统中,进入“高级系统设置”,点击“环境变量”。在“系统变量”中编辑Path,添加Maven的bin...
将下载的压缩包解压到开发工具常用的目录,例如D:\developer\apache-maven-3.9.1-bin。 配置系统环境变量。在Windows系统中,进入“高级系统设置”,点击“环境变量”。在“系统变量”中编辑Path,添加Maven的bin...
将下载的压缩包解压到开发工具常用的目录,例如D:\developer\apache-maven-3.9.1-bin。 配置系统环境变量。在Windows系统中,进入“高级系统设置”,点击“环境变量”。在“系统变量”中编辑Path,添加Maven的bin...
将下载的压缩包解压到开发工具常用的目录,例如D:\developer\apache-maven-3.9.1-bin。 配置系统环境变量。在Windows系统中,进入“高级系统设置”,点击“环境变量”。在“系统变量”中编辑Path,添加Maven的bin...
将下载的压缩包解压到开发工具常用的目录,例如D:\developer\apache-maven-3.9.1-bin。 配置系统环境变量。在Windows系统中,进入“高级系统设置”,点击“环境变量”。在“系统变量”中编辑Path,添加Maven的bin...
将下载的压缩包解压到开发工具常用的目录,例如D:\developer\apache-maven-3.9.1-bin。 配置系统环境变量。在Windows系统中,进入“高级系统设置”,点击“环境变量”。在“系统变量”中编辑Path,添加Maven的bin...