2013-01-08 4 views
17

Jak skonfigurować maven project do wdrażania zarówno migawek, jak i wydań do Nexusa?Jak skonfigurować maven project, aby wdrożyć zarówno migawki i wydania na Nexus?

<distributionManagement> 
    <repository> 
     <id>InternalReleases</id> 
     <name>Internal Releases</name> 
     <url>http://192.168.16.232:8081/nexus/content/repositories/releases/</url> 
    </repository> 
    <repository> 
     <id>InternalSnapshots</id> 
     <name>Internal Snapshots</name> 
     <url>http://192.168.16.232:8081/nexus/content/repositories/snapshots/</url> 
    </repository> 
</distributionManagement> 

Taka konfiguracja powoduje błąd w Eclipse 3.8 z m2e 1.2

Project build error: Non-parseable POM D:\Workspaces\W\Parent\pom.xml: Duplicated tag: 'repository' (position: START_TAG 
seen ... 

Chcę artefakt wdrożony do repozytorium InternalSnapshots gdy wersja POM jest sufiksem z -SNAPSHOT i wdrożony do repozytorium InternalReleases kiedy go to ZWOLNIENIE. To powinno się zdarzyć, używając tego samego pliku pom.xml i wykonując tę ​​samą komendę mvn deploy.

Odpowiedz

28

Należy rozróżnić repozytorium wersji i migawek. <distributionManagement> zezwala tylko na jedno dziecko: <repository> i jedno <snapshotRepository>.

http://maven.apache.org/pom.html#Distribution_Management

+1

Profile pozwalają korzystać z różnych Sekcje . Jeśli masz wiele i , możesz to zrobić za pomocą różnych profili. –

18

Przykład konfiguracji pom.xml

<!-- http://maven.apache.org/pom.html#Distribution_Management --> 
<distributionManagement> 
    <snapshotRepository> 
     <id>InternalSnapshots</id> 
     <name>Internal Snapshots</name> 
     <url>http://192.168.16.232:8081/nexus/content/repositories/snapshots/</url> 
    </snapshotRepository> 
    <repository> 
     <id>InternalReleases</id> 
     <name>Internal Releases</name> 
     <url>http://192.168.16.232:8081/nexus/content/repositories/releases/</url> 
    </repository> 
</distributionManagement> 

Snippets dla .m2/settings.xml dla domyślnej instalacji Nexus

<server> 
    <id>thirdparty</id> 
    <username>deployment</username> 
    <password>deployment123</password> 
</server> 
<server> 
    <id>InternalReleases</id> 
    <username>deployment</username> 
    <password>deployment123</password> 
</server> 
<server> 
    <id>InternalSnapshots</id> 
    <username>deployment</username> 
    <password>deployment123</password> 
</server> 

0

można zrobić jedno i drugie.

Dodaj maven-RELEASE-plugin 2.5.3

uruchom następujące:

mvn wdrożyć czyste: do wydania: przygotowanie wydania: wykonać

+1

To jest miłe, ale wymaga skonfigurowania maven i projektu, i to była sól pytania: jak skonfigurować –

Powiązane problemy