<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配置的一些标签含义(后续逐渐补充)的更多相关文章

  1. Maven项目pom.xml 标签含义

    project:pom.xml文件中的顶层元素: modelVersion:指明POM使用的对象模型的版本.这个值很少改动. groupId:指明创建项目的组织或者小组的唯一标识.GroupId是项目 ...

  2. H5的语义化标签(PS: 后续继续补充)

    头部信息 <header></header> 区块标签 <figure> <figcaption>123</figcaption> < ...

  3. Maven配置详见

    CSDN 2016博客之星评选结果公布    [系列直播]零基础学习微信小程序!      "我的2016"主题征文活动   博客的神秘功能 maven 配置详解 标签: mave ...

  4. Maven 配置 Selenium + testNG + reportNG 运行环境

    .markdown-preview:not([data-use-github-style]) { padding: 2em; font-size: 1.2em; color: rgb(56, 58, ...

  5. Spark之路 --- Scala IDE Maven配置(使用开源中国的Maven库)和使用

    为什么要使用Maven 摘自百度百科的介绍 Maven是基于项目对象模型(POM),可以通过一小段描述信息来管理项目的构建,报告和文档的软件项目管理工具.Maven 除了以程序构建能力为特色之外,还提 ...

  6. STS中Maven配置

    最近接触maven, 配置过程中记录一下. STS是解压版的,启动后,可以看到已经有了Maven插件, , 但是,STS也同时给你了一个Maven,但是通常不建议使用STS自带的maven.使用默认的 ...

  7. maven配置详解

    什么是pom?     pom作为项目对象模型.通过xml表示maven项目,使用pom.xml来实现.主要描述了项目:包括配置文件:开发者需要遵循的规则,缺陷管理系统,组织和licenses,项目的 ...

  8. 03_MyBatis基本查询,mapper文件的定义,测试代码的编写,resultMap配置返回值,sql片段配置,select标签标签中的内容介绍,配置使用二级缓存,使用别名的数据类型,条件查询ma

     1 PersonTestMapper.xml中的内容如下: <?xmlversion="1.0"encoding="UTF-8"?> < ...

  9. maven配置src/resources默认目录

    在maven工程中,我们会将配置文件放到,src/main/resources   下面,例如 我们需要确认resource 下的文件 编译之后存放的位置 它编译的路径直接位于classes下面,这个 ...

随机推荐

  1. MQ单一消息完整流程

    public class QueueManger { private static string QueuePath = @".\private$\{0}"; /// <su ...

  2. WebForm 【复合控件】

    一 复合控件(取值,赋值用法相近)  RadioButtonList      --单选按钮 (一组列表)  <asp:RadioButtonList ID="RadioButtonL ...

  3. [javaEE] Servlet的调用过程和生命周期

    在http协议的请求头中获取到要访问的资源,查找web.xml文件找到对应的servelet Sevlet的生命周期 Servlet在第一次被访问的时候,服务器创建出Servlet对象,创建出对象以后 ...

  4. Substrings(hdu1238)字符串匹配

    Substrings Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Sub ...

  5. 在学习使用webpack中遇到的错误

    1.局部安装webpack之后使用node_modules/.bin/webpack app/main.js public/bundle.js命令报错      解决方法:      webpack版 ...

  6. maven插件 按配置加载不同环境配置文件进行打包(maven-war-plugin)

    1.配置多种不同环境 如(本地local,开发dev,测试test 环境等) <profiles> <profile> <id>local</id> & ...

  7. JS代理模式实现图片预加载

    ---恢复内容开始--- 刚刚说了懒加载,现在我们来搞搞预加载吧 预加载的核心: 图片等静态资源在使用前提前请求. 资源后续使用可以直接从缓存中加载,提升用户体验. 几个误区: 预加载不是为了减少页面 ...

  8. SwipeRefreshLayout嵌套ScrollView实现下拉刷新

    API doc:http://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html 首先须 ...

  9. 结合 spring 使用阿里 Druid 连接池配置方法

    1.数据源 <!-- 配置数据源 --> <bean name="dataSource" class="com.alibaba.druid.pool.D ...

  10. Sql server中的 nvarchar(max) 到底有多大?(转载)

    问题: SQL server中的nvarchar(max)最大的长度是4000个字吗? 如果字段的内容超过4000个字时用什么类型呢?text 还是binary?他们的最大长度是多少?比如字段放的是长 ...