Manifest files

I'm sorry in advance that I can’t give the exact code, because I don’t have it now. However, I ran into a problem trying to pack my project in a jar. I used the maven build plugin in my pom.xml to collect all the dependencies and the jar of the project in one place. But now I need all these dependency banks to have their own manifest file. Can I implement some Maven properties in some way? Now, the only solution I came up with is to use the Maven shade plugin and create uber-jar, but the problem is that some dependencies have user manifests (like Spring framework) that get lost and only one manifest for uber-jar is created. Is there any way to say maven for unpacking dependencies, edit manifestEntries and assemble them again and put together with the project bank in zip?

In short: basically, what I want to know is whether it is possible to somehow modify the file inside one of the dependency containers or in all bars with a dependency at once? Say my project has a dependency on spring - beans. Now I would like to modify a specific file inside spring - beans.jar, in particular manifest.md, before collecting them into a single ZIP file, which should contain project.jar and spring - beans.jar (with manifest.md changed). I think something like this is possible with the maven antrunner plugin?

Example:

<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>com.mycompany.app</groupId>
  <artifactId>project</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>
  <name>Project</name>

  <dependencies>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
    </dependency>
  </dependencies>

  <build>
        <plugins>
              <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                  <descriptors>
                    <descriptor>src/main/assembly/src.xml</descriptor>
                  </descriptors>
                </configuration>
              </plugin>
        </plugins>
  </build>
</project>

manifest.md spring -core.jar, spring -context.jar spring - beans.jar. , , uber jar, manifest.md, , - , , , .

+5

All Articles