maven
来源:互联网 发布:淘宝店铺怎么利用营销 编辑:程序博客网 时间:2024/06/10 10:45
pom.xml
<?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">
<!--所有的Maven项目都必须配置这四个配置项-->
<modelVersion>4.0.0</modelVersion>
<!--groupId指的是项目名的项目组,默认就是包名-->
<groupId>cn.gacl.maven.hello</groupId>
<!--artifactId指的是项目中的某一个模块,默认命名方式是"项目名-模块名"-->
<artifactId>hello-first</artifactId>
<!--version指的是版本,这里使用的是Maven的快照版本-->
<version>SNAPSHOT-0.0.1</version>
</project>
快速新建一个maven项目
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
1.进入到项目根目录,然后使用命令”mvn compile”进行编译,
使用Maven编译完成之后,在项目根目录下会生成一个target文件夹
2.使用"mvn clean"命令清除编译结果,也就是把编译生成的target文件夹删掉
3. mvn test
3.1 mvn test-compile
4. mvn package
5. mvn install
6. mvn process-resources
you can execute the following command (process-resources is the build lifecycle phase where the resources are copied and filtered):
setting up, building, testing, packaging, and installing a typical Maven project
7. mvn clean compile -Duser.name=foobar 在编译时加入系统变量
8.
在编译项目时,可以使用 -P 参数指定需要使用的 profile 的 id,比如下面命令将会使用 development profile:
$mvn clean compile -Pdevelopment
<project>
...
<profiles>
<profile>
<id>development</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<filters>
<filter>profile-development.properties</filter>
</filters>
</build>
</profile>
<profile>
<id>production</id>
<build>
<filters>
<filter>profile-production.properties</filter>
</filters>
</build>
</profile>
</profiles>
</project>
假如不指定 -P 参数的话,则会使用 activeByDefault=true 的一项(即 development)
<?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">
<!--所有的Maven项目都必须配置这四个配置项-->
<modelVersion>4.0.0</modelVersion>
<!--groupId指的是项目名的项目组,默认就是包名-->
<groupId>cn.gacl.maven.hello</groupId>
<!--artifactId指的是项目中的某一个模块,默认命名方式是"项目名-模块名"-->
<artifactId>hello-first</artifactId>
<!--version指的是版本,这里使用的是Maven的快照版本-->
<version>SNAPSHOT-0.0.1</version>
</project>
快速新建一个maven项目
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
1.进入到项目根目录,然后使用命令”mvn compile”进行编译,
使用Maven编译完成之后,在项目根目录下会生成一个target文件夹
2.使用"mvn clean"命令清除编译结果,也就是把编译生成的target文件夹删掉
3. mvn test
3.1 mvn test-compile
4. mvn package
5. mvn install
6. mvn process-resources
you can execute the following command (process-resources is the build lifecycle phase where the resources are copied and filtered):
setting up, building, testing, packaging, and installing a typical Maven project
7. mvn clean compile -Duser.name=foobar 在编译时加入系统变量
8.
在编译项目时,可以使用 -P 参数指定需要使用的 profile 的 id,比如下面命令将会使用 development profile:
$mvn clean compile -Pdevelopment
9. maven scope
当我们用maven install生成最终的构件包ProjectABC.war后,在其下的WEB-INF/lib中,会包含我们被标注为scope=compile的构件的jar包,而不会包含我们被标注为scope=provided的构件的jar包。这也避免了此类构件当部署到目标容器后产生包依赖冲突。<project>
...
<profiles>
<profile>
<id>development</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<filters>
<filter>profile-development.properties</filter>
</filters>
</build>
</profile>
<profile>
<id>production</id>
<build>
<filters>
<filter>profile-production.properties</filter>
</filters>
</build>
</profile>
</profiles>
</project>
假如不指定 -P 参数的话,则会使用 activeByDefault=true 的一项(即 development)
0 0
- Maven
- Maven
- Maven
- maven
- Maven
- Maven
- maven
- maven
- maven
- maven
- Maven
- maven .
- Maven
- maven
- maven
- maven
- MAVEN
- Maven
- leetcode_c++:Find Minimum in Rotated Sorted Array (153)
- Spring定时任务的几种实现
- 电梯调度算法 summary
- Linux内核通信之---proc文件系统(详解)
- Oracle的存储结构 2013-03-26 23:22 276人阅读 评论(0) 收藏 举报 目录(?)[+] Oracle的存储结构 在ORACLE数据库中对于数据存储的管理可以从两方面来论述。
- maven
- 【步兵 lua】尾递归 打印table
- 群控电梯调度算法
- leetcode_c++: Find Minimum in Rotated Sorted Array II(154)
- oracle第三章复习
- HttpClient框架提交数据
- Linux进程退出详解(do_exit)--Linux进程的管理与调度(十四))
- 解决Spring定时计划任务重复执行两次(实例被构造两次)问题的方法
- Valid Sudoku