简体   繁体   中英

maven distributionManagement outside the pom

Anyway I can move the distributionManagement part outside the pom I don't like the idea that my pom.xml contains server location, Is it possible to move this or server name to settings.xml? Thanks

<distributionManagement>
    <repository>
        <id>archiva</id>
        <name>archiva Repo</name>
        <url>http://ca.server:8080/archiva/repository/snapshots/</url>
    </repository>
    <snapshotRepository>
        <uniqueVersion>false</uniqueVersion>
        <id>archiva</id>
        <name>archiva Repo</name>
        <url>http://ca.server:8080/archiva/repository/snapshots/</url>
    </snapshotRepository>
</distributionManagement>

最好的想法是将这些信息放入父POM(公司pom)并使用它来代替settings.xml,因为任何想要构建的机构都需要更改settings.xml。

Short answer: Yes, you can.

Longer answer: I like the idea too, because I could imagine that the application will be built and distributed on different servers. So I like the following:

  • Define in the POM the dependencies to other libraries and plugins.
  • Define in your Maven installation configuration (so it is dependent on the installation, not on the user using that installation) what you have sketched out in your question.
  • Normally, you need a user-id and password to distribute in a Maven repository, and this is the (only) contents of it:

     <settings> <servers> <server> <id>archiva</id> <username>XXadmin-user-nameXX</username> <password>XXadmin-passwordXX</password> </server> </servers> </settings> 

This should only be on the build server configured by the build manager and not known by everyone. The only thing you have to ensure is that the IDs are the same in both files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM