1
[ERROR] Failed to execute goal io.openliberty.tools:liberty-maven-plugin:3.7.1:deploy (package-server) on project my-service: Cannot invoke "java.io.File.getCanonicalPath()" because "fatArchiveSrc" is null -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

With mvn install -X the last trace is:

Caused by: java.lang.NullPointerException: Cannot invoke "java.io.File.getCanonicalPath()" because "fatArchiveSrc" is null
    at io.openliberty.tools.maven.applications.DeployMojo.installSpringBootApp (DeployMojo.java:114)
    at io.openliberty.tools.maven.applications.DeployMojo.doExecute (DeployMojo.java:79)
    at org.codehaus.mojo.pluginsupport.MojoSupport.execute (MojoSupport.java:122)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:260)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:172)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:100)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:821)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:270)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:578)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

mvn compile works fine, and neither Google or Bing can find anything about "fatArchiveSrc"; how to solve this error?

fatArchiveSrc is part of the ci.maven source code and needs a Spring Boot jar according to Spring boot app's .jar not working (issue with tomcat-embed-jasper)

mvn install -DskipTests works for my colleague but he then moved some dependency info from the main pom.xml to the war pom.xml and now I get this error:

[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.7:report (report) on project my-service-war: An error has occurred in JaCoCo report generation.: Error while creating report: Error while analyzing /Users/user/Documents/code/my-service/my-service-war/target/classes/nl/company/Application.class. Unsupported class file major version 63 -> [Help 1]

WAR and EAR aren't in the target folders, so we might be further from home.

Main pom.xml:

<?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>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.6</version>
    </parent>

    <groupId>nl.company</groupId>
    <artifactId>my-service</artifactId>
    <version>0.1.0</version>
    <packaging>pom</packaging>
    <name>my-service</name>
    <description>Facade service</description>

    <modules>
        <module>my-service-ear</module>
        <module>my-service-war</module>
    </modules>


    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>

        <sonar.dependencyCheck.htmlReportPath>${project.basedir}/target/dependency-check-report.html</sonar.dependencyCheck.htmlReportPath>
        <scm-connection>scm:git:ssh://[email protected]:7999/my-service.git</scm-connection>

        <log4j.version>2.18.0</log4j.version>
        <junit.version>5.8.2</junit.version>
        <mockito.version>4.6.1</mockito.version>
        <java.version>17</java.version>

        <!-- Overige -->
        <!-- Zorgt ervoor dat de classes ook de namen van parameters bevatten, maakt Jackson gebruik eenvoudiger -->
        <maven.compiler.parameters>true</maven.compiler.parameters>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- Module dependencies -->
            <dependency>
                <groupId>nl.company</groupId>
                <artifactId>my-service-war</artifactId>
                <version>${project.version}</version>
                <type>war</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

</project>

my-service-war/pom.xml:

<?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>
    <parent>
        <groupId>nl.company</groupId>
        <artifactId>my-service</artifactId>
        <version>0.1.0</version>
    </parent>

    <artifactId>my-service-war</artifactId>
    <packaging>war</packaging>
    <name>${project.artifactId}</name>
    <description>API proxy.</description>


    <dependencies>
        <!-- Module dependencies -->
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-common</artifactId>
            <version>3.0.5</version>
            <scope>test</scope>
        </dependency>

        <!-- Spring -->
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.6.14</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <version>2.5.5</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Testing -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>

            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.22.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <environmentVariables>
                        <MICRO_CONFIG>${project.basedir}/src/test/resources/META-INF</MICRO_CONFIG>
                        <DX_LOG_DIR>${project.build.testOutputDirectory}</DX_LOG_DIR>
                    </environmentVariables>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.7</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.2</version>
                <configuration>
                    <warName>my-service-${project.version}.war</warName>
                    <attachClasses>true</attachClasses>
                    <classesClassifier>classes</classesClassifier>
                </configuration>
            </plugin>

            <!-- Enable Liberty Maven plugin -->
            <plugin>
                <groupId>io.openliberty.tools</groupId>
                <artifactId>liberty-maven-plugin</artifactId>
                <version>3.7.1</version>
                <configuration>
                    <appsDirectory>apps</appsDirectory>
                    <installAppPackages>spring-boot-project</installAppPackages>
                    <include>minify,runnable</include>
                    <packageName>my-service</packageName>
                </configuration>
                <executions>
                    <execution>
                        <id>package-server</id>
                        <phase>package</phase>
                        <goals>
                            <goal>create</goal>
                            <goal>install-feature</goal>
                            <goal>deploy</goal>
                            <goal>package</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <properties>
        <maven.compiler.source>19</maven.compiler.source>
        <maven.compiler.target>19</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

</project>

my-service-ear/pom.xml:

<?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>
    <parent>
        <groupId>nl.copany</groupId>
        <artifactId>my-service</artifactId>
        <version>0.1.0</version>
    </parent>

    <artifactId>my-service-ear</artifactId>
    <packaging>ear</packaging>
    <name>${project.artifactId}</name>
    <description>EAR deployable</description>

    <dependencies>
        <dependency>
            <groupId>nl.copany</groupId>
            <artifactId>my-service-war</artifactId>
            <type>war</type>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <modules>
                        <webModule>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>my-service-war</artifactId>
                            <bundleFileName>my-service-${project.version}.war</bundleFileName>
                            <contextRoot>/my-service</contextRoot>
                        </webModule>
                    </modules>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
2
  • change the order of spring-boot-maven-plugin and maven-war-plugin plugins in my-service-war/pom.xml, m.b. it also required to configure dedicated classifier for spring-boot-maven-plugin Commented Mar 21, 2023 at 11:55
  • @AndreyB.Panfilov I tried that but mvn install -DskipTests returns the same JaCoCo error. mvn clean install -DskipTests however works now, but does still after reverting your suggestion. Commented Mar 21, 2023 at 12:15

1 Answer 1

0

Turns out I forgot to mvn clean as mvn install -DskipTests works now. The test errors are a different issue, related to using command line how run junit test present inside the war file

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.