1

I´m trying to update a manifest file adding a pair of new lines inside a classpath.

I have something like this in my pom:

<plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <configuration>
                            <archive>
                                <manifest>
                                    <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                    <addClasspath>true</addClasspath>
                                </manifest>
                                <manifestEntries>
                                    <Class-Path>./ttttttttttttttt/</Class-Path>
                                </manifestEntries>
                            </archive>
                        </configuration>
                    </plugin>

The result of this change is the next one:

Manifest-Version: 1.0
Implementation-Title: server
Implementation-Version: 0.1.0-SNAPSHOT
Archiver-Version: Plexus Archiver
Built-By: vcima
Implementation-Vendor-Id: es.solution.ok
Class-Path: **../ttttttttttttttt/** configuration-0.1.0-SNAPSHOT.jar 
 tip-0.1.0-SNAPSHOT.jar quartz-2.2.1.jar c3p0-0.9.1.1.jar quartz-
 jobs-2.2.1.jar 
company: My company
Created-By: Apache Maven 3.3.3
Build-Jdk: 1.8.0_111
Main-Class: es.example.srv.ServerRunner

That its right but i need that the new line was added at the end of the classpath for several reasons: order of the libraries is important in this case...

I´m looking the workaround for something like this:

Manifest-Version: 1.0
    Implementation-Title: server
    Implementation-Version: 0.1.0-SNAPSHOT
    Archiver-Version: Plexus Archiver
    Built-By: vcima
    Implementation-Vendor-Id: es.solution.ok
    Class-Path: configuration-0.1.0-SNAPSHOT.jar 
     tip-0.1.0-SNAPSHOT.jar quartz-2.2.1.jar c3p0-0.9.1.1.jar quartz-
     jobs-2.2.1.jar **../ttttttttttttttt/** 
    company: My company
    Created-By: Apache Maven 3.3.3
    Build-Jdk: 1.8.0_111
    Main-Class: es.example.srv.ServerRunner

Could anyone help me?.

Best regards!

vcima
  • 421
  • 1
  • 7
  • 20
  • Why is the order important to you? Maven will list your classpath dependencies in the order you have declared them in your POM. Can't you simply put the dependency you need at the end in the `` section of your POM? – Daniel Dec 18 '16 at 12:39
  • Because these external dependencies that i have to reference in the project can affect the behaviour of my libraries if are declared at the beggining, it is the reason. – vcima Dec 18 '16 at 12:46
  • I need the references for these external libraries inside of the manifest but i dont want to have the external libraries in my project with my jars.... If you know the way to achive this with the pom will be great for me, but i dont know if is really possible. – vcima Dec 18 '16 at 13:01
  • I am not sure it's possible with `maven-jar-plugin`. I have tried different combinations of `` together with `custom`, but only managed to get it to work if you have one single dependency. – Daniel Dec 18 '16 at 13:13
  • Do you know if there is any option inside param of the dependency inside the pom to reach this result: reference inside manifest but doesnt store the library? – vcima Dec 18 '16 at 13:16
  • Tried that too using `system` scope but it requires an actual (single) file... – Daniel Dec 18 '16 at 13:21
  • Whatever issue there is that requires you to have a list in a specific order, fix _that_ issue. [It isn't documented](http://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html#classpath) how the order of the entries play in class loading, so trying to have a specific order is not guaranteed to be respected anyway. – Tunaki Dec 18 '16 at 18:03

0 Answers0