0

We made a custom library for Bonita BPE in Java that has the pom shown below:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>our.company</groupId>
    <artifactId>library</artifactId>
    <version>0.0.1</version>
    <packaging>jar</packaging>
    <name>Bonita messages library</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>11</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <bonita-runtime.version>7.13.0</bonita-runtime.version>
        <junit-jupiter-engine.version>5.7.2</junit-jupiter-engine.version>
        <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
        <mockito-core.version>3.11.2</mockito-core.version>
        <logback-classic.version>1.2.5</logback-classic.version>
    </properties>        
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.bonitasoft.runtime</groupId>
                <artifactId>bonita-runtime-bom</artifactId>
                <version>${bonita-runtime.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.bonitasoft.engine</groupId>
            <artifactId>bonita-common</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.24</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit-jupiter-engine.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>${junit-jupiter-engine.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>${mockito-core.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback-classic.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.squareup.retrofit2</groupId>
            <artifactId>retrofit</artifactId>
            <version>2.1.0</version>
        </dependency>
        <dependency>
            <groupId>com.squareup.retrofit2</groupId>
            <artifactId>converter-gson</artifactId>
            <version>2.1.0</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.code.gson</groupId>
                    <artifactId>gson</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.9.0</version>
        </dependency>
    </dependencies>
    <distributionManagement>
        <repository>
            <id>releases</id>
            <name>MyCo Internal Repository</name>
            <url>https://myco.internalrepository.local/repository/maven-releases/</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <name>MyCo Internal Snapshots</name>
            <url>https://myco.internalrepository.local/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>
    <build>
        <plugins>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nxrm3-maven-plugin</artifactId>
                <version>1.0.3</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <id>default-deploy</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
            <configuration>
                <serverId>releases</serverId>
                <nexusUrl>https://myco.internalrepository.local</nexusUrl>
                <repository>maven-releases</repository>
                <skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
            </configuration>
            </plugin>
        </plugins>
    </build>
</project>

We want to distribute the JAR across the dev team deploying it to our Nexus3 repo but we encountered a little of a head-scratcher: if we install the library on our local maven repo with mvn install and add the jar to Bonita as a file then sees all the transitive deps and put them in the deployment as it should; but if we deploy the JAR to nexus with mvn deploy:deploy and add the library to the project using nexus we only see some of the dependencies, leading to ClassDefNotFound exceptions in the remote environment.

In this particular case, we couldn't manage to make Bonita Studio aware that retrofit2 needs okio and okhttp libs too, so those two are transitive dependencies of retrofit2. But, as said earlier, if we install the JAR locally, those two libraries are seen and added to the list of dependencies.

We would like, in time, to use our nexus as a Maven central proxy but at this point we shut it off just to be sure that all the dependencies are correct and nexus is not corrupting their poms for some weird reason.

We didn't find any difference in the two JARs themselves and we couldn't make any sense of it.

Is this a known behaviour? Are we missing something key in how to deploy a Bonita custom library or a JAR in general?

halfer
  • 19,824
  • 17
  • 99
  • 186
GoGoLander
  • 349
  • 3
  • 12

0 Answers0