3

I have developers who use Maven parents external to my organisation. For this particular case the parent is the spring-boot-starter-parent

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.1.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

Their builds are working and they have been testing against these dependencies for a long time, I ideally do not want to change their inheritance.

The problem I have as a Release Engineer is that the artifacts produced need to be stored in an internal Maven Repository. We've historically done that by having a Maven Parent that defines the and nothing else, that all projects had as the root of their inheritance chain.

I could end up managing hundreds of POMS and I don't want to put in each one as if we have to move the internal Maven repository I will have to manage a ridiculous number of projects to reflect the change.

Is there any way I can set where I essentially don't have write access to parents? Can this be set in MAVEN_OPTS or as a properties file on the CI servers? I have tried using properties-maven-plugin to input all of our properties but distributionManagement won't accept a property as a variable.

Shaun
  • 475
  • 1
  • 5
  • 16
  • I do not really understand what you are trying to achieve. The artifacts that you build should go to an artifact repository, like Nexus or Artifactory. Usually, they would be deployed by the build server to that repository. You could also proxy the external repositories in your Nexus/Artifactory so that you have a copy of all used parent poms inside. – J Fabian Meier Feb 17 '17 at 11:43
  • The developments teams usually use a parent pom which essentially defines our version of a super POM. The development team in this case are using the spring-boot-starter-parent rather than "our" parent and as such are not inheriting the same stuff as the rest of our builds. Performing a Maven release:perform fails to deploy as the release repository cannot be found (as there is no deploymentManagement set). I want to be able to allow developers to use parents external (i.e. not owned by) to the organisation and still be able to release them to our internal repo – Shaun Feb 17 '17 at 14:39

1 Answers1

1

Keeping your org parent pom (other than the parent element you specified earlier) would need you to bring Spring Boot dependencies as a bom:

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-dependencies</artifactId>
      <version>1.4.1.RELEASE</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

But I think the less intrusive way might be to set the proper version to your modules using:

mvn versions:set before building the artifacts and deploying to Nexus (or other Maven repo manager)

ootero
  • 3,235
  • 2
  • 16
  • 22
  • The pom import worked. I am now able to pull in all of the spring-boot dependencies and use a corporate POM that details where Artifactory is. This doesn't pull in the Plugins only the dependencies but for my scenario this is acceptable. – Shaun Feb 23 '17 at 10:26