Abhishek Maurya
Abhishek Maurya

Reputation: 195

Maven 3.9.9 upgrade making build fail

I am creating a jar by combining and building below jars using the dependencies listed below with Maven version 3.9.9. Previously, it worked with version 3.8.8 version but failling when I am trying to run the new jar(generated by builing the pom.xml) that is build with 3.9.9(error: Could not find or load main class mic.App). I am using Java 8 for this.

<?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>AB</groupId>
  <artifactId>TESTJAVA</artifactId>
  <version>41.1</version>

  <name>TESTJAVA</name>

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

  <dependencies>
     <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.26</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.26</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java -->
    <dependency>
        <groupId>com.google.protobuf</groupId>
        <artifactId>protobuf-java</artifactId>
        <version>3.21.7</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.13.0</version>
    </dependency>
    
    <!-- Local Dependecies -->
    
    <dependency>
      <groupId>msdrg</groupId>
      <artifactId>msdrg</artifactId>
      <version>41.1.0.0</version>
      <scope>system</scope>
      <systemPath>${pom.basedir}/lib/abc-v411-41.1.0.0.jar</systemPath>
    </dependency>

    <dependency>
      <groupId>binary-access</groupId>
      <artifactId>binary-access</artifactId>
      <version>1.1.0</version>
      <scope>system</scope>
      <systemPath>${pom.basedir}/lib/bsdry-abcs-1.1.0.jar</systemPath>
    </dependency>
    
    <dependency>
      <groupId>gfc-base-api</groupId>
      <artifactId>gfc-base-api</artifactId>
      <version>3.4.9</version>
      <scope>system</scope>
      <systemPath>${pom.basedir}/lib/ga-bsde-aai-3.4.9.jar</systemPath>
    </dependency>

    <dependency>
      <groupId>msdrg-model</groupId>
      <artifactId>msdrg-model</artifactId>
      <version>2.5.0</version>
      <scope>system</scope>
      <systemPath>${pom.basedir}/lib/mssd-modasl-v2-2.5.0.jar</systemPath>
    </dependency>
    <!-- Testing Dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <mainClass>mic/App</mainClass>
              <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
          </manifest>
          <manifestEntries>
              <Java-Version>${java.version}</Java-Version>
              <Java-Vendor>${java.vendor}</Java-Vendor>
              <Os-Name>${os.name}</Os-Name>
              <Os-Arch>${os.arch}</Os-Arch>
              <Os-Version>${os.version}</Os-Version>
           </manifestEntries>
          </archive>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
          <finalName>${project.artifactId}-${project.version}</finalName>
          <appendAssemblyId>false</appendAssemblyId>
        </configuration>
        <executions>
          <execution>
            <id>make-assembly</id> <!-- this is used for inheritance merges -->
            <phase>package</phase> <!-- bind to the packaging phase -->
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

I attempted to upgrade the dependencies slf4j-simple, slf4j-api, protobuf-java, and jackson-core, but the effort was unsuccessful.

Upvotes: 1

Views: 87

Answers (0)

Related Questions