Child pages
  • maven goal 정리 및 Best Practice

Contents

Goals

maven all plugins update

mvn clean package -U,--update-snapshots

-U means Forces a check for updated releases and snapshots on remote repositories

http://stackoverflow.com/questions/4701532/force-maven-update

모든 plugin 의 update 를 체크하므로 build 속도가 느려짐. snapshots update 때문에 그렇다면 snapshot update Policy 를 조정

maven deploy

pom.xml 파일
<distributionManagement>
        <snapshotRepository>
                <id>snapshots</id>
                <name>snapshot Repository</name>
                <url>http://nexus.example.com/content/repositories/snapshots/</url>
        </snapshotRepository>
        <repository>
                <id>releases</id>
                <name>Release Repository</name>
                <url>http://nexus.example.com/content/repositories/releases/</url>
        </repository>
 <repository>
                          <uniqueVersion>true</uniqueVersion>
                          <id>tech.release</id>
                          <name>Tech Support Release Repository</name>
                          <url>https://nexus.example.com/content/repositories/com.example/</url>
                          <layout>default</layout>
                </repository>
                <snapshotRepository>
                        <uniqueVersion>true</uniqueVersion>
                        <id>tech.snapshots</id>
                        <name>Tech Support Snapshots Repository</name>
                        <url>https://nexus.example.com/content/repositories/com.example.snapshot/</url>
                        <layout>default</layout>
                </snapshotRepository>
  </distributionManagement>

 

Maven command to list lifecycle phases along with bound goals?

One tool that helps is mvn help:effective-pom It will print the POM with all variables and all parent POMs expanded. This helps to understand what Maven sees. From that, it's pretty simple to find all the additional goals (which usually aren't that many).

The bigger problem is the implicit goals (i.e. when a plugin hooks itself to some phases of the lifecycle automatically). There is no easy way to see these without actually running Maven. This should become better in Maven 3. Until then, run Maven with -X which will print a whole lot of debug output plus the current phase and which plugins are executed.

 

mvn help:describe -Dcmd=compile 


  1. mvn help:describe

mvn help:effective-settings

 

mvn help:help -Ddetail=true

 

 

Best Practice

settings.xml -  http://maven.apache.org/settings.html

<servers>
		<server>
			<id>company.snapshots</id>
			<username>deploy-snapshot</username>
			<password>deployment123</password>
		</server>	
<server>
			<id>company.releases</id>
			<username>deploy-release</username>
			<password>deployment123</password>
		</server>	
     <server>
                <id>test.snapshots</id>
                <username>test</username>
                <password>testproj</password>
        </server>
        <server>
                <id>test.release</id>
                <username>test</username>
                <password>testproj</password>
        </server>
	</servers>

 

Ref

  • No labels

1 Comment