Skip to content

ow2-proactive/parent-bom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

parent-bom

parent bom project managing dependencies version

How to use the plugin in other micro-service projects

dependency management plugin definition in the micro-service project's build.gradle file

  1. Declare the dependency management plugin in the buildscript block as following
buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE'
        classpath "com.diffplug.gradle.spotless:spotless:2.4.0"
        classpath "org.ow2.proactive:coding-rules:1.0.0"
        ... ...
        classpath "io.spring.gradle:dependency-management-plugin:0.3.0.RELEASE"
    }
}
  1. Apply the plugin
apply plugin: "io.spring.dependency-management"
  1. Import this parent-bom pom file into your micro-service project
dependencyManagement {
    imports {
        mavenBom "org.ow2.proactive:parent-bom:${version}"
    }
}
  1. Remove the versions from the dependencies block, except the proactive dependencies

For example,

dependencies {
    providedCompile "org.ow2.proactive_grid_cloud_portal:rest-client:$version"
    providedCompile "org.ow2.proactive:common-client:$version"

    compile 'commons-fileupload:commons-fileupload'

    compile "org.apache.logging.log4j:log4j-web"

    compile 'org.springframework.boot:spring-boot-starter-data-jpa'

    compile 'org.hibernate:hibernate-entitymanager'
    compile 'org.hibernate:hibernate-core'
    
    ...
    ...
}

Note: the exclusions must be done in parent-bom pom file, not in the dependencies block in the build.gradle file

How to add new dependencies version in parent-bom project

All dependencies version must be managed in this parent-bom project. When a new dependency version is needed, the parent-bom's pom.xml file needs to be updated to add this new dependency's version.

  1. Verify the same dependency does not exist already by checking in the pom.xml file the properties block, which all dependencies versions are declared there.
<properties>
        <springboot.version>1.3.3.RELEASE</springboot.version>
        <commonsfileupload.version>1.3.1</commonsfileupload.version>
        <log4jweb.version>2.7</log4jweb.version>
        <junit.version>4.11</junit.version>
        ...
        ...
</properties>        
  1. Create a new property for the new dependency's version in the properties block

  2. Add a new dependency sub-block in the dependencyManangement block, like following

 <dependencyManagement>
        <dependencies>
            <!-- spring boot -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-jpa</artifactId>
                <version>${springboot.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-entitymanager</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-validation</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            ...
            ...
</dependencyManagement>            

as you can see in the sample, the exlusions are mamaged here in the block too, so that when this dependency is imported in the micro-service's build.gradle, the exclusions are already done, do not repeat the exclusions declaration again in the build.gradle.

  1. Build and commit the parent-bom project, the nightly-release will generate and upload the artifact to the proactive repository, after which the new dependency can be imported into the micro-service project then.

How to test parent-bom changes locally

  1. Edit the version inside pom.xml. For example:

13.1.0-SNAPSHOT

  1. run mvn install to install locally your changes

  2. build projects which use parent-bom with option -Plocal.

Common issues

  • The Error "detached configuration" means that it cannot solve the dependencies.

  • When parent-bom will be updated, you will have to launch the parent-bom-release jenkins job to update the version on the nexus repository.

  • Be sure that activeeon repository is in your buildscript repositories in build.gradle.

About

parent bom project managing dependencies version

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published