关于Maven配置的一些标签含义(后续逐渐补充)
<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.daxin</groupId>
<artifactId>maven_params_test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>maven_params_test</name>
<url>http://maven.apache.org</url> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> <dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies> <build>
<!-- 指定过滤resources下面的application.properties -->
<filters>
<filter>src/main/resources/application.properties</filter>
</filters>
<resources>
<!--是定义哪些目录下的文件会被配置文件中定义的变量替换 -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<!-- 指定打包的jar名字 -->
<!-- projectName_PROJECTvERSION -->
<finalName>${name}_${version}</finalName> <!-- The directory where compiled application classes are placed. 用来存储编译的class文件 -->
<outputDirectory>E:\code\mvnoutput</outputDirectory>
<!-- 配置源文件所在位置 -->
<sourceDirectory>src/main/java</sourceDirectory> <!-- The directory where all files generated by the build are placed.
其实就是修改默认的target位置
-->
<directory>E:\code\dict</directory> <!-- build中的extensions是执行构建过程中可能用到的其他工lib,在执行构建的过程中被加入到classpath中。 -->
<extensions>
<extension>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</extension>
</extensions> <plugins>
<!-- maven打包插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.daxin.maven.params.test.Main</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin> </plugins> </build> <profiles>
<!-- maven 进行打包部署时候可以根据-P 传递参数进行不同环境的配置,例如:开发环境和部署环境的jdbc的host不同的话,可以使用maven
profile配置 -->
<!-- maven package -P debug 就可以激活id为debug的配置信息 -->
<profile>
<!-- profile的唯一标识,打包时候可以使用-P参数进行激活 -->
<id>debug</id>
<properties>
<pom.env>debug</pom.env>
<jdbc.url>debug_jdbc_host</jdbc.url>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile> <profile>
<id>deploy</id>
<properties>
<pom.env>deploy</pom.env>
<jdbc.url>deploy_jdbc_host</jdbc.url>
</properties>
</profile>
</profiles> </project>
mvn运行java程序,需要使用插件,其中${mainClass}是我们自定义的参数,我们可以使用mvn传入该参数:mvn exec:java -DmainClass=com.daxin.maven.params.test.Main
其中-D表示传入参数,mainClass是属性名字。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>${mainClass}</mainClass>
</configuration>
</plugin>
关于Maven配置的一些标签含义(后续逐渐补充)的更多相关文章
- Maven项目pom.xml 标签含义
project:pom.xml文件中的顶层元素: modelVersion:指明POM使用的对象模型的版本.这个值很少改动. groupId:指明创建项目的组织或者小组的唯一标识.GroupId是项目 ...
- H5的语义化标签(PS: 后续继续补充)
头部信息 <header></header> 区块标签 <figure> <figcaption>123</figcaption> < ...
- Maven配置详见
CSDN 2016博客之星评选结果公布 [系列直播]零基础学习微信小程序! "我的2016"主题征文活动 博客的神秘功能 maven 配置详解 标签: mave ...
- Maven 配置 Selenium + testNG + reportNG 运行环境
.markdown-preview:not([data-use-github-style]) { padding: 2em; font-size: 1.2em; color: rgb(56, 58, ...
- Spark之路 --- Scala IDE Maven配置(使用开源中国的Maven库)和使用
为什么要使用Maven 摘自百度百科的介绍 Maven是基于项目对象模型(POM),可以通过一小段描述信息来管理项目的构建,报告和文档的软件项目管理工具.Maven 除了以程序构建能力为特色之外,还提 ...
- STS中Maven配置
最近接触maven, 配置过程中记录一下. STS是解压版的,启动后,可以看到已经有了Maven插件, , 但是,STS也同时给你了一个Maven,但是通常不建议使用STS自带的maven.使用默认的 ...
- maven配置详解
什么是pom? pom作为项目对象模型.通过xml表示maven项目,使用pom.xml来实现.主要描述了项目:包括配置文件:开发者需要遵循的规则,缺陷管理系统,组织和licenses,项目的 ...
- 03_MyBatis基本查询,mapper文件的定义,测试代码的编写,resultMap配置返回值,sql片段配置,select标签标签中的内容介绍,配置使用二级缓存,使用别名的数据类型,条件查询ma
1 PersonTestMapper.xml中的内容如下: <?xmlversion="1.0"encoding="UTF-8"?> < ...
- maven配置src/resources默认目录
在maven工程中,我们会将配置文件放到,src/main/resources 下面,例如 我们需要确认resource 下的文件 编译之后存放的位置 它编译的路径直接位于classes下面,这个 ...
随机推荐
- [javaSE] 看博客学习java并发编程
共享性 多线程操作同一个数据,产生线程安全问题 新建一个类ShareData 设计一个int 型的成员变量count 设计一个成员方法addCount(),把count变量++ 在main函数中开启多 ...
- Python 进阶必备函数
1. lambda 表达式 匿名函数(英语:anonymous function)是指一类无需定义标识符(函数名)的函数.通俗来说呢,就是它可以让我们的函数,可以不需要函数名. 正常情况下,我们定义一 ...
- 解决ios10以上版本缩放问题
<script type="text/javascript"> /*解决ios10以上版本缩放问题 20171102*/ window.onload=function ...
- PHP解决中文乱码
在php中,中文乱码非常头疼,很麻烦,所以根据在编程的经验,总结以下方法(以utf_8为例), 1.php中在头部header设置编码方式 header("Content-type:text ...
- js-ES6学习笔记-字符串的扩展
1.codePointAt方法是测试一个字符由两个字节还是由四个字节组成的最简单方法.codePointAt方法会正确返回32位的UTF-16字符的码点. function is32Bit(c) { ...
- CSS隐藏多余的文字
效果: <p><strong>商品名称:</strong>新鲜现摘云南绥江半边红李子甜脆脱骨李6斤当季绿色有机水果包邮</p></div> ...
- CAT3 SAP tcode - Time Sheet: Display Times
CAT3 SAP tcode - Time Sheet: Display Times CAT3 (Time Sheet: Display Times) is a standard SAP transa ...
- ActiveReports 报表应用教程 (11)---交互式报表之文档目录
通过文档目录,用户可以非常清晰的查看报表数据结构,并能方便地跳转到指定的章节,最终还可以将报表导出为PDF等格式的文件.本文以2012年各月产品销售分类汇总报表为例,演示如何在葡萄城ActiveRep ...
- Impala随手记
最近开始使用Impala,基本完全兼容传统SQL,并且查询速度飞快,是Hive的良好替代: 1.登录及简单查询 impala-shell #列出数据库 show databases; #载入数据库 u ...
- Android GetMethodID 函数的说明
GetFieldID是得到java类中的参数ID,GetMethodID得到java类中方法的ID,它们只能调用类中声明为 public的参数或方法.使用如下: jfieldID topicField ...