schmmd
schmmd

Reputation: 19478

multiple deployment repositories with maven

I have a source repository for which I use maven. Usually I want to deploy projects to an internal repository, so I have this repository in the parent POM. However, I also need to declare this repository in each project POM so that project can find the parent POM (a relative path to the parent POM only works if the versions are the same).

Sometime I want to deliver code to another party. It needs to end up in their maven repository. However, all of my POMs have a reference to my internal repository, which does not seem proper. Is there a good way to hide my internal repository from the deployments I make to the other party?

I could handle this with profiles (an internal and a foreign profile for which repository I want to deploy to), however, I would need to make a profile for EACH project and not just the parent POM, which is a pain. Maybe this is the best solution however?

Upvotes: 1

Views: 483

Answers (1)

Vijay
Vijay

Reputation: 425

You can define a repository URL property in parent pom (for example, ${repository.deploy}). Also create profiles in parent pom (like local and foriegn) which will assign different value to this property.

In all child project pom files, use the parent defined property for repository URL. This way the other party can switch repository URL by using a different profile at parent level. Does this answer your question?

Upvotes: 2

Related Questions