I'm running a Websphere 7 project. Pom structure is the following:
my project
<parent>
<groupId>company</groupId>
<artifactId>websphere-superpom</artifactId>
<version>version</version>
</parent>
<dependencies>
...
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.5</version>
</dependency>
</dependencies>
...
websphere-superpom
<dependencies>
...
<dependency>
<groupId>com.ibm.websphere</groupId>
<artifactId>runtime-dependencies</artifactId>
<version>version</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
</dependencies>
runtime-dependencies
<dependencies>
...
<dependency>
<groupId>com.ibm.websphere</groupId>
<artifactId>j2ee</artifactId>
<version>version</version>
</dependency>
</dependencies>
Artifact j2ee contains several packages, among them there is also javax.el
and it is loaded before the one I declare in my project's pom.
I run a JUnit test with the option -verbose:class
and the output confirmed this problem.
[Loaded javax.el.ExpressionFactory from file:/C:/Program Files (x86)/IBM/SDP/runtimes/base_v7/lib/j2ee.jar]
I then run the following command in Maven console:
mvn dependency:analyze -DcheckDuplicateClasses
and the output I got is this:
[WARNING] Unused declared dependencies found:
...
[WARNING] javax.el:javax.el-api:jar:2.2.5:compile
...
How to tell Maven to load ExpressionFactory from the library I declared in my project's pom? I cannot change websphere-superpom because it's a company managed artifact.
EDIT: As asked by watery I tried to redeclare the offending dependency in my project's pom as following:
<dependency>
<groupId>com.ibm.websphere</groupId>
<artifactId>runtime-dependencies</artifactId>
<version>version</version>
<exclusions>
<exclusion>
<groupId>com.ibm.websphere</groupId>
<artifactId>j2ee</artifactId>
</exclusion>
</exclusions>
</dependency>
But then Maven tells me:
Could not resolve dependencies for project ....: Failure to find com.ibm.websphere:runtime-dependencies:jar in nexus url