0

I have added the jar names on the classpath to the manifest file by the method described in official documentation.

i.e. by adding

<manifest>
    <addClasspath>true</addClasspath>
</manifest>

to the ejb plugin. Now I do not want ALL such files, but want to exclude some of them (because they are directly provided by webSphere and should not be listed).

Question: Is there any exclude mechanism I can apply here?

ᄂ ᄀ
  • 5,669
  • 6
  • 43
  • 57
J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142

1 Answers1

1

Maven dependencies which are provided by your target container should be listed as scope provided. As per official documentation

This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive.

Hence, you should set the concerned dependencies as scope provided:

<dependency>
    <groupId>...</groupId>
    <artifactId>..</artifactId>
    <version>...</version>
    <scope>provided</scope>
</dependency>

Maven will use it for compilation, testing but not for packaging. And it will also be excluded from Manifest classpath.

You can check this SO question about difference between provided and compile scope (the default one, no need to specify it at each dependency declaraction) while this SO question had exactly the opposite issue.

Community
  • 1
  • 1
A_Di-Matteo
  • 26,902
  • 7
  • 94
  • 128