javajenkins-pipelinemaven-plugininstall4j

Install4J Jenkins build fails after migration from Install4J 7 to 10


after the migration from Install4J 7 to 10 we are facing issues while building.

The build is done via Jenkins pipeline. There we are using the Maven install4J plugin which is configured as follows

<build>
            <plugins>
                <plugin>
                    <groupId>org.sonatype.install4j</groupId>
                    <artifactId>install4j-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>install4j-regular-build</id>
                            <phase>validate</phase>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                            <configuration>
                                <projectFile>misc/install4j/regular.install4j</projectFile>
                                <winKeystorePassword>SECRETREMOVED</winKeystorePassword>
                                <jvmArguments>
                                    <arg>-Dinstall4j.connectTimeout=20000</arg>
                                    <arg>-Dinstall4j.readTimeout=20000</arg>
                                    <arg>-Dinstall4j.counterSignRetry=20</arg>
                                    <arg>-Dinstall4j.timestampUrl=${signing.timestamp-server}</arg>
                                </jvmArguments>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

For the migration we haven't changed anything regarding Maven plugin configuration. Except for updating the plugins to the latest releases. Now the build fails with

[ERROR] Failed to execute goal org.sonatype.install4j:install4j-maven-plugin:1.1.2:compile (install4j-regular-build) on project irisplus-client: null returned: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonatype.install4j:install4j-maven-plugin:1.1.2:compile (install4j-regular-build) on project clientName: null returned: 1

We also installed the latest version of the license server and added the new floating license. But in this step we still get the following log output regarding the license

[INFO] install4j version 10.0.6 (build 10097), built on 2023-06-19
[INFO] Using Java 11.0.10 from /usr/local/openjdk-11
[INFO] Please run the command line executable with the -L [license key] option or open the install4j IDE to enter a license key.

<?xml version="1.0" encoding="UTF-8"?>
<install4JCommon version="10.0.6" lookAndFeel="1" mainFrameIconMode="largeWithText" editorIconMode="largeWithText" rememberWindowSizes="true" showMultipleTabsNotice="true" browserCommand="" openLastProjectOnStartup="true" floatingMultiPlatform="true" useOnlineDocumentation="false" showIds="false" printIdsForExport="false">
  <licenseKey name="" company="" key="FLOAT:OURHOSTNAME:11862" />
  <directoryPresets config="" export="" />
  <recentProjects />
  <codeCompletionSettings codeCompletionAutoImport="true" codeCompletionAutoPopup="true" codeCompletionAutoPopupDelay="1000" codeCompletionLookupHeight="10" problemsLevel="all" />
  <jdks />
  <beanSelectorSettings>
    <applications largeIcons="true" />
    <formComponents largeIcons="true" />
    <actionList largeIcons="true" />
    <styles largeIcons="true" />
  </beanSelectorSettings>
</install4JCommon>

Via Install4J IDE the DryRun and Build are executed successfully.

Any help and ideas will be appreciated :)


Solution

  • As for the maven build failure, you would first have to switch to the official maven plugin, the sonatype plugin is no longer developed. You just have to replace

    <groupId>org.sonatype.install4j</groupId>
    <artifactId>install4j-maven-plugin</artifactId>
    

    with

    <groupId>com.install4j</groupId>
    <artifactId>install4j-maven</artifactId>
    

    and add a plugin repository to your POM

    <pluginRepositories>
      <pluginRepository>
        <id>ej-technologies</id>
        <url>https://maven.ej-technologies.com/repository</url>
      </pluginRepository>
    </pluginRepositories>
    

    Also, with the new maven plugin, you can set the "license" parameter to set the license key directly in the invocation. Then, it does not matter which user runs the build.