[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How should I deal with the classpath with maven-helper?



Hi,

I'm trying to package some java code with maven-helper, and I have a
few questions regarding the class-path of the built jar.

To put it in a nutshell: how should it be handled? What are the good practices?

More precisely:
* If I don't do anything special regarding the class-path, then I get
the lintian warning missing-classpath [1]
* If I add the classpath via the pom.xml, ie

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <addClasspath>true</addClasspath>
          </manifest>
        </archive>
      </configuration>
    </plugin>

 then the warning goes away, but the MANIFEST of the built jar
contains a class-path like

    Class-Path: guava-debian.jar aXMLRPC-debian.jar

so when I try to launch my application with a wrapper script which looks like

    java -cp /usr/share/java/my.jar

it fails as soon as it tries to load a class from another jar since it
can't find them.

Of course, for an application I could just add manually the jar needed
in my wrapper script. However, it wouldn't apply to the case when I
try to package a library

I've tried to look in existing packages and in the documentation, but
couldn't find an answer. I would
be grateful if you can give me some pointers.

Regards,
Guillaume

[1]: https://lintian.debian.org/tags/missing-classpath.html


Reply to: