0

I added the following Jackson dataformat dependency to be able to serialize/deserialize Java POJO to/from XML:

    <dependency>
        <groupId>com.fasterxml.jackson.dataformat</groupId>
        <artifactId>jackson-dataformat-xml</artifactId>
        <version>2.12.7</version>
    </dependency>

I am building a component that will introduce changes to a deployed instance and usually I am expected to generate one or two JAR files. After I added the above dependency, I noticed that I have to add the following JAR files to the classpath of the main deployed instance so that it works:

  1. jackson-annotations-2.14.2.jar
  2. jackson-core-2.14.2.jar
  3. jackson-databind-2.14.2.jar
  4. jackson-dataformat-xml-2.12.7.jar
  5. woodstox-core-6.2.4.jar
  6. stax2-api-4.2.1.jar
  7. jackson-module-jaxb-annotations-2.12.7.jar

In addition to the above, I have to generate the JAR file for the newly developed classes. I am using the following section in pom.xml for this purpose:

    <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
            <execution>
                <id>final</id>
                <goals>
                    <goal>jar</goal>
                </goals>
                <phase>package</phase>
                <configuration>
                    <classifier></classifier>
                    <finalName>NewJARFileName</finalName>
                    <includes>
                        <include>com\path\to\java\classes1\**</include>
                        <include>com\path\to\java\classes2\**</include>
                        ...
                    </includes>
                    <excludes>
                        <exclude>**/*.properties</exclude>
                    </excludes>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                    </archive>
                </configuration>
            </execution>
        </executions>
    </plugin>

I am manually copying the above files to the lib folder of the deployed instance and I modified the classpath accordingly. Everything is working file, however, I'm trying to find a way to combine the new 7 JAR files with the JAR file I am building into 1 or 2 files during the build process to simplify the deployment process.

I appreciate your help.

tarekahf
  • 738
  • 1
  • 16
  • 42
  • @life888888 I think so ... It seems that `maven-shade-plugin` is what I need. I will check it out. Thak you so much! – tarekahf Mar 07 '23 at 02:23

0 Answers0