Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple deployments in maven

We have a internal artifactory repository. At the moment all snapshots will be deployed there. We also want to have a different server with a web interface, and want to copy the to it the created artifacts.

For our builds we use Hudson, but the post-build action "Deploy artifacts to Maven repository" together with scp doesn't work. So there is the question of doing it in some other elegant way. Why isn't maven able to have several distribution repositories? Any ideas?

The nicest thing would be if artifactory would support an (automatic!) incremental export to a standard maven repository after each new deployment.

like image 300
Mauli Avatar asked Mar 11 '09 15:03

Mauli


People also ask

Does Maven deploy also build?

So, the answer is yes, mvn deploy will execute install and build the project artifacts.

How does Maven deploy work?

The deploy plugin is primarily used during the deploy phase, to add your artifact(s) to a remote repository for sharing with other developers and projects. This is usually done in an integration or release environment.


1 Answers

I don't think maven supports deploying to multiple repositories for a single profile, but perhaps profiles could change the id and urls of the repository.

  <distributionManagement>
    <repository>
      <id>${repo-id}</id>
      <name>${repo-name}</name>
      <url>${repo-url}</url>
    </repository>
  </distributionManagement>

Maven Deployment

Then use profiles to pick which repo to deploy to:

<profiles>
  <profile>
    <id>repo1</id>
    <activation>
      <activeByDefault>true</activeByDefault>
    </activation>
    <properties>
      <repo-id>repo1</repo-id>
      <repo-name>Repo1 Name </repo-name>
      <repo-url>http://url.com/maven2</repo-url>
    </properties>
  </profile>
  <profile>
    <id>repo2</id>
    <properties>
      <repo-id>repo2</repo-id>
      <repo-name>Repo2 Name </repo-name>
      <repo-url>http://url2.com/maven2</repo-url>
    </properties>
  </profile>
</profiles>

Maven profiles

like image 109
jon077 Avatar answered Nov 08 '22 15:11

jon077