понедельник, 14 марта 2011 г.

 

How to edit maven Super POM

Sometimes you want to move some common information from the maven project to one place. But you don't want to create a parent POM for all your projects (maybe because of versioning problems - each child project must know exact version of parent project).

The example of such common information is <distributionManagement> section that can't be place at settings.xml as we know. Hovewer, the is a thing that can help us - it's called maven Super POM. Good article about Maven POM and Super POM could be found here.

To put some information into the Super POM you should edit file ${M2_HOME}/lib/maven-2.1.0-uber.jar/org/apache/maven/project/pom-4.0.0.xml (here I use maven-2.1.0, so change path according to your version).

You can place your section of distribution management right after <name> section like that:

<project>
<modelVersion>4.0.0</modelVersion>
<name>Maven Default Project</name>

<distributionManagement>
<repository>
<id>depser</id>
<name>ext-releases</name>
<url>http://artifactory.example.com:8081/artifactory/ext-releases</url>
</repository>
<snapshotRepository>
<id>depser</id>
<name>ext-snapshots</name>
<url>http://artifactory.example.com:8081/artifactory/ext-snapshots</url>
</snapshotRepository>
</distributionManagement>

<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>


...


Now you can remove this section from yout project POM files and test the result with mvn deploy command

Ярлыки:


Комментарии:
Pretty workaround)). It's really sadly profiles don't support distributionManagement element.
Waiting maven 3...
 

Отправить комментарий

Подпишитесь на каналы Комментарии к сообщению [Atom]





<< Главная страница

This page is powered by Blogger. Isn't yours?

Подпишитесь на каналы Сообщения [Atom]