Why does Maven download different versions of Spring artifacts? - spring

In my Maven project I have defined a bunch of Spring dependencies, and I notice that in some cases it will choose different versions of the artifacts even though they are specified identically in my pom.xml.
This is an outline of mvn dependency:tree
[INFO] com.vrutberg.blogping:blogping:war:1.0-SNAPSHOT
[INFO] +- junit:junit:jar:4.7:test
[INFO] +- javax.servlet:servlet-api:jar:2.4:compile
[INFO] +- com.sun.jersey:jersey-server:jar:1.12:compile
[INFO] | +- asm:asm:jar:3.1:compile
[INFO] | \- com.sun.jersey:jersey-core:jar:1.12:compile
[INFO] +- com.sun.jersey:jersey-bundle:jar:1.12:compile
[INFO] +- javax.ws.rs:jsr311-api:jar:1.1.1:compile
[INFO] +- org.springframework:spring-core:jar:3.0.0.RC3:compile
[INFO] +- org.springframework:spring-expression:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:3.0.0.RC3:compile
[INFO] +- org.springframework:spring-aop:jar:3.0.0.RC3:compile
[INFO] +- org.springframework:spring-context:jar:3.0.0.RC3:compile
[INFO] +- org.springframework:spring-context-support:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:3.0.5.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-orm:jar:3.0.5.RELEASE:compile
[INFO] | \- org.springframework:spring-jdbc:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-oxm:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:3.0.0.RC3:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.0.5.RELEASE:compile
[INFO] | \- org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-test:jar:3.0.5.RELEASE:test
[INFO] \- com.sun.jersey.contribs:jersey-spring:jar:1.12:compile
[INFO] \- com.sun.jersey:jersey-servlet:jar:1.12:compile
In my pom.xml I have defined a property which I use on all Spring artifacts, and it's defined like so:
<org.springframework.version>3.0.5.RELEASE</org.springframework.version>
And these are my dependencies:
<!-- spring libraries -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework.version}</version>
<scope>test</scope>
</dependency>
Why on earth does it use different versions?
Edit:
Okay, so I just discovered these warnings. I suppose this has something to do with it:
Downloading: http://download.java.net/maven/2/org/springframework/spring-core/3.0.0.RC3/spring-core-3.0.0.RC3.pom
Downloading: http://repo1.maven.org/maven2/org/springframework/spring-core/3.0.0.RC3/spring-core-3.0.0.RC3.pom
[WARNING] Missing POM for org.springframework:spring-core:jar:3.0.5.RELEASE
Downloading: http://download.java.net/maven/2/org/springframework/spring-beans/3.0.0.RC3/spring-beans-3.0.0.RC3.pom
Downloading: http://repo1.maven.org/maven2/org/springframework/spring-beans/3.0.0.RC3/spring-beans-3.0.0.RC3.pom
[WARNING] Missing POM for org.springframework:spring-beans:jar:3.0.5.RELEASE
Downloading: http://download.java.net/maven/2/org/springframework/spring-aop/3.0.0.RC3/spring-aop-3.0.0.RC3.pom
Downloading: http://repo1.maven.org/maven2/org/springframework/spring-aop/3.0.0.RC3/spring-aop-3.0.0.RC3.pom
[WARNING] Missing POM for org.springframework:spring-aop:jar:3.0.5.RELEASE
Downloading: http://download.java.net/maven/2/org/springframework/spring-context/3.0.0.RC3/spring-context-3.0.0.RC3.pom
Downloading: http://repo1.maven.org/maven2/org/springframework/spring-context/3.0.0.RC3/spring-context-3.0.0.RC3.pom
[WARNING] Missing POM for org.springframework:spring-context:jar:3.0.5.RELEASE
Downloading: http://download.java.net/maven/2/org/springframework/spring-web/3.0.0.RC3/spring-web-3.0.0.RC3.pom
Downloading: http://repo1.maven.org/maven2/org/springframework/spring-web/3.0.0.RC3/spring-web-3.0.0.RC3.pom
[WARNING] Missing POM for org.springframework:spring-web:jar:3.0.5.RELEASE
Why are the poms missing for some artifacts though? And why does it fall back to using 3.0.0.RC3?

In eclipse, at least in the last version, there is a pom view where you can see the dependency tree so you can find out why a library is added as a consecuence of other library.

Related

What's the correct place to put dependency in pom.xml file?

This is what my pom.xml looks like
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>stark</groupId>
<artifactId>stark-parent</artifactId>
<version>1.5.0</version>
</parent>
<groupId>api</groupId>
<artifactId>adapter-mvp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>adapter-mvp</name>
<description>adapter-mvp grpc service</description>
<properties>
<business-domains-model.version>0.0.9-847a022</business-domains-model.version>
<!-- Test dependencies versions-->
<blockhound.version>1.0.4.RELEASE</blockhound.version>
<jacoco.coverage.line>0.1</jacoco.coverage.line>
<jacoco.coverage.branch>0.16
</jacoco.coverage.branch>
<detekt.config>detekt.yml</detekt.config>
</properties>
<dependencyManagement> ---------------line 24
<dependencies>
<dependency>
<groupId>io.projectreactor.tools</groupId>
<artifactId>blockhound</artifactId>
<version>${blockhound.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Test dependencies --> -----------------line 35
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
<exclusion>
<groupId>org.jvnet.staxex</groupId>
<artifactId>stax-ex</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.projectreactor.tools</groupId>
<artifactId>blockhound</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>eg-gtp-tax-engine-adapter-mvp</finalName>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<pluginManagement>
<plugins>
</plugins>
</pluginManagement>
</build>
</project>
I want add these three dependencies to that pom file, when I put them under line 35, I got error "Cannot resolve com.amazonaws:aws-java-sdk-bom:1.11.974"
when I put them under line 24, I got error in my code, it seems like I didn't add secretsmanager dependency to that pom, can anyone help me with this issue? What's the correct place to put those dependencies?
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-bom</artifactId>
<version>1.11.974</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>1.11.974</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-secretsmanager</artifactId>
<version>1.11.974</version>
</dependency>
Error
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.BannedDependencies failed with message:
| =====================================================================================
| You have included a banned library, and you need to remove the dependency.
| It is likely a transitive dependency of another library you have added to this POM,
| the easiest way for you to determine how the dependency was added is to run:
|
| %> mvn dependency:tree -Dverbose=true
|
| and scan that output for references to the offending dependency (listed after this
| message) - you will either need to refactor that dependency to not use the
| offending library (if you control the source) or to add an exclusion for that
| library here in this pom (there are numerous examples).
| ======================================================================================
Found Banned Dependency: commons-logging:commons-logging:jar:1.1.3
Use 'mvn dependency:tree' to locate the source of the banned dependencies.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.665 s
[INFO] Finished at: 2021-03-14T22:36:27-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M1:enforce (enforce-banned-logging-libraries) on project eg-gtp-tax-engine-adapter-mvp: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
dependency tree
[INFO] +- com.amazonaws:aws-java-sdk-secretsmanager:jar:1.11.974:compile
[INFO] | +- com.amazonaws:aws-java-sdk-core:jar:1.11.974:compile
[INFO] | | +- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.5.13:compile
[INFO] | | | +- org.apache.httpcomponents:httpcore:jar:4.4.14:compile
[INFO] | | | \- commons-codec:commons-codec:jar:1.15:compile
[INFO] | | +- software.amazon.ion:ion-java:jar:1.0.2:compile
[INFO] | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.11.3:compile
[INFO] | | \- joda-time:joda-time:jar:2.8.1:compile
[INFO] | \- com.amazonaws:jmespath-java:jar:1.11.974:compile
The BOM dependency should go in the <dependencyManagement> section
<dependencyManagement>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-bom</artifactId>
<version>1.11.974</version>
<type>pom</type>
<scope>import</scope>
</dependency>
....
....
</dependencyManagement>
BOM dependency will manage the versions for the other aws module dependencies. Thus, rest of the dependencies can go inside section without version parameter.
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-bom</artifactId>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-secretsmanager</artifactId>
</dependency>
...
...
</dependencies>

How to override the version numbers from Spring Boot when importing a BOM pom?

How do I override the version numbers being imported by Spring Boot, without manually setting each artifact in the dependency management section?
<properties>
<spring.boot.version>1.5.7.RELEASE</spring.boot.version>
<jackson.version>2.9.1</jackson.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>${jackson.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
However, when I run
mvn dependency:tree "-Dincludes=com.fasterxml.jackson.*" -Dverbose
the output
[INFO] ------------------------------------------------------------------------
[INFO] Building dpt-domain-core 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # dpt-domain-core ---
[INFO] net.initech.dpt:dpt-domain-core:jar:1.0.0
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.8.10:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.10:compile
[INFO] | +- (com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile - omitted for duplicate)
[INFO] | \- (com.fasterxml.jackson.core:jackson-core:jar:2.8.10:compile - omitted for duplicate)
[INFO] \- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.8.10:compile
[INFO] +- (com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile - omitted for duplicate)
[INFO] +- (com.fasterxml.jackson.core:jackson-core:jar:2.8.10:compile - omitted for duplicate)
[INFO] \- (com.fasterxml.jackson.core:jackson-databind:jar:2.8.10:compile - omitted for duplicate)
Where 2.8.10 is the value of jackson.version that org.springframework.boot:spring-boot-dependencies:1.5.7.RELEASE:pom defines.
However, if I explicitly add
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
to my dependency management section, then it resolves correctly to:
[INFO] ------------------------------------------------------------------------
[INFO] Building dpt-domain-core 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # dpt-domain-core ---
[INFO] org.autodatacorp.dpt:dpt-domain-core:jar:1.0.0
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.1:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.9.1:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.1:compile
[INFO] \- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.1:compile
[INFO] ------------------------------------------------------------------------
Which is perplexing, since that seems like it should be the equivalent of doing an import of com.fasterxml.jackson:jackson-bom:2.9.1:pom should be the equivalent of pasting the contents of that code into manually.
I even tried
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
</exclusion>
</exclusions>
<type>pom</type>
<scope>import</scope>
</dependency>
but with no effect.
PS - incase it matters, the Maven I am using is:
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00)
Java version: 9, vendor: Oracle Corporation
You can re-order your BOM imports and this will work. Place Jackson BOM before the Spring Boot BOM. Quick example https://github.com/Flaw101/gsonconverter/blob/feature/jackson_override/pom.xml
If you use the Spring Boot Parent POM you just need to override their property jackson.version to override versions of other frameworks/libraries
This is also documented by Spring Boot,
https://docs.spring.io/platform/docs/current/reference/html/getting-started-overriding-versions.html
A couple of additional links,
https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-build-systems.html#using-boot-maven-parent-pom
https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-build-systems.html#using-boot-maven-without-a-parent
Adding jackson-bom.version to your properties section of the pom.xml file should update jackson dependencies. This will override jackson version in the Spring Boot Parent POM.
<properties>
<jackson-bom.version>2.12.1</jackson-bom.version>
</properties>
Using jackson.version is not going to work. Please see https://github.com/spring-projects/spring-boot/issues/17808
In the app
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>${jackson.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

Maven Compilation error: cannot find symbol with local dependecies

When I run "mvn compile" on my Maven project, I get error messages like the following:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/rommelrico/Documents/GitHub/github.sandiego.edu/SeniorSurvey/src/main/java/edu/sandiego/custom/SeniorSurveyPortlet.java:[4,37] cannot find symbol
symbol : class Person
location: package com.sghe.luminis.person.entity
I have a set of closed-source files that I installed as follows:
mvn install:install-file -Dfile=aspectjrt.jar -DgroupId=some.group -DartifactId=aspectjrt -Dversion=1 -Dpackaging=jar
And when I list the Maven dependencies, they appear to be fine (no errors):
[INFO] ------------------------------------------------------------------------
[INFO] Building SeniorSurvey Portlet 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:list (default-cli) # SeniorSurveyPortlet ---
[INFO]
[INFO] The following files have been resolved:
[INFO] some.group:util-taglib:jar:1:compile
[INFO] some.group:sqljdbc4:jar:1:compile
[INFO] some.group:util-java:jar:1:compile
[INFO] some.group:luminis-security-base:jar:1:compile
[INFO] com.googlecode.json-simple:json-simple:jar:1.1:compile
[INFO] commons-logging:commons-logging:jar:1.1.1:compile
[INFO] some.group:luminis-security-policy:jar:1:compile
[INFO] log4j:log4j:jar:1.2.12:compile
[INFO] javax.servlet:jstl:jar:1.1.2:compile
[INFO] some.group:util-bridges:jar:1:compile
[INFO] some.group:aspectjrt:jar:1:compile
[INFO] some.group:luminis-session:jar:1:compile
[INFO] org.json:json:jar:20090211:compile
[INFO] some.group:luminis-dal:jar:1:compile
[INFO] taglibs:standard:jar:1.0.4:compile
[INFO] some.group:spring-2.5.5:jar:1:compile
[INFO] xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] some.group:jasig-cas-client-core-3.1.3:jar:1:compile
[INFO] some.group:spring-security-cas-client-2.0.5.RELEASE:jar:1:compile
[INFO] some.group:spring-security-core-2.0.5.RELEASE-mod:jar:1:compile
[INFO] org.jsoup:jsoup:jar:1.7.2:compile
[INFO] some.group:luminis-person:jar:1:compile
[INFO] com.sun.jersey:jersey-client:jar:1.8:compile
[INFO] com.sun.jersey:jersey-core:jar:1.8:compile
[INFO] xalan:xalan:jar:2.6.0:compile
[INFO] some.group:luminis-util:jar:1:compile
[INFO] some.group:luminis-security-springweb:jar:1:compile
[INFO] org.apache.portals.pluto:pluto-taglib:jar:2.0.0:provided
[INFO] javax.servlet:servlet-api:jar:2.4:compile
[INFO] javax.portlet:portlet-api:jar:2.0:provided
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.177 s
[INFO] Finished at: 2014-09-24T12:02:59-08:00
[INFO] Final Memory: 8M/81M
[INFO] ------------------------------------------------------------------------
My POM dependencies:
<dependencies>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.7.2</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.12</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.portals.pluto</groupId>
<artifactId>pluto-taglib</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>aspectjrt</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>jasig-cas-client-core-3.1.3</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>luminis-dal</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>luminis-person</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>luminis-security-base</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>luminis-security-policy</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>luminis-security-springweb</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>luminis-session</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>luminis-util</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>spring-2.5.5</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>spring-security-cas-client-2.0.5.RELEASE</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>spring-security-core-2.0.5.RELEASE-mod</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>sqljdbc4</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>util-bridges</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>util-java</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>util-taglib</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
</dependencies>
And my IntelliJ settings:
In IntelliJ, my imports and code is not "red" meaning it can resolve it to the jar files. But when I run mvn compile it says "cannot find symbol". What's more frustrating is that if I do the same thing in Eclipse, it works fine, but in IntelliJ it doesn't. What is the problem? It's driving me crazy.
Hold CTRL and click on the person class on line 4 of SeniorSurveyPortlet.
You should see the file location in the IntelliJ window title.
The location should be an artifact in your local maven repo (i.e a directory named .m2).
The path contains the groupId, artifactId and version.
Ensure that the dependency is listed correctly in the pom.

Complicated Maven Dependency for Demonstration

I have to perform a demonstration on the benefits of Maven. I am trying to find a complicated dependency with multiple levels of transitive dependencies to really show the power of the dependency management aspect of the tool.
The dependency should be in the Maven central repository as I want to keep the demonstration as simple as possible.
Can anybody suggest a suitable one? (The more complicated the better.)
hibernate-core seems quite complicated:
[INFO] +- org.hibernate:hibernate-core:jar:4.2.0.Final:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] | +- org.javassist:javassist:jar:3.15.0-GA:compile
[INFO] | \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
<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>it.unitn.margonar</groupId>
<artifactId>SpringMavenJPA</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.8.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.1.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.1.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.1.3.RELEASE</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.1.3.RELEASE</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>20030825.184428</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>20030825.183949</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.1.8.Final</version>
</dependency>
</dependencies>
</project>

Debugging java.lang.IncompatibleClassChangeError: Implementing class errors (Spring/Hibernate/Struts)

I recently began trying to upgrade some dependencies of a Struts2/Spring/Hibernate application that were several years out of date -- primarily to try to pick up the #Enumerated annotation. The POM is getting cleaner along the way, which is a nice side effect
All the code compiles and the unit tests pass, but the server won't start with the
"Caused by: java.lang.IncompatibleClassChangeError: Implementing class"
error message.
I've followed several threads that talk about tracking down version mismatches in dependencies -- people often seem to get two version of hibernate. I don't think I have that problem:
[INFO] [snip MyProjectName]
[INFO] \- org.hibernate:hibernate-entitymanager:jar:3.5.6-Final:compile
[INFO] +- org.hibernate:hibernate-core:jar:3.5.6-Final:compile
[INFO] \- org.hibernate:hibernate-annotations:jar:3.5.6-Final:compile
[INFO] \- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
At first I thought that the 3.2.0.Final reference was the cause, but further research make its sound like its just an empty placeholder artifact for legacy sake.
My spring dependencies I think are the problem, however, but I'm not sure what to fix, or if I'm looking at another red herring:
[INFO] [snip MyProjectName]
[INFO] +- org.springframework:org.springframework.orm:jar:3.1.1.RELEASE:compile
[INFO] | +- org.springframework:org.springframework.jdbc:jar:3.1.1.RELEASE:compile
[INFO] | \- org.springframework:org.springframework.transaction:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:org.springframework.web:jar:3.1.1.RELEASE:compile
[INFO] | \- org.springframework:org.springframework.aop:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:org.springframework.beans:jar:3.1.1.RELEASE:compile
[INFO] | \- org.springframework:org.springframework.asm:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:org.springframework.context:jar:3.1.1.RELEASE:compile
[INFO] | \- org.springframework:org.springframework.expression:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:org.springframework.core:jar:3.1.1.RELEASE:compile
[INFO] \- org.apache.struts:struts2-spring-plugin:jar:2.2.3.1:compile
[INFO] +- org.springframework:spring-beans:jar:2.5.6:compile
[INFO] +- org.springframework:spring-core:jar:2.5.6:compile
[INFO] +- org.springframework:spring-context:jar:2.5.6:compile
[INFO] \- org.springframework:spring-web:jar:2.5.6:compile
so I think I see two possible problems
the struts2-spring-plugin is pulling in old versions of spring -- however every web resource I've found so far says that the struts2-spring-plugin should work with new versions of spring. Am I doing something wrong here? I haven't found other newer versions of the plugin to try.
I had to switch to the ERB spring repository in order to even find the new versions of spring, so the artifactIds aren't matching across the two -- the direct spring dependencies are org.springframework:org.springframe.{component} while the indirect are org.springframework:spring-{component}. Is this a problem? I tried looking for the struts2-spring-plugin in the ERB spring repository, but they don't host it, so I doubt I can find a version that matches on the artifactId naming scheme.
I'm listing the complete dependency section of the pom next, in case both of the above are red herrings. Are there other tools/investigations I should be using to figure out the problem? Thank you.
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymockclassextension</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>r07</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.5.6-Final</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901.jdbc3</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.orm</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.web</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.beans</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.context</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.core</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.2.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.2.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>2.2.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-json-plugin</artifactId>
<version>2.2.3.1</version>
</dependency>
<dependency>
<groupId>com.jgeppert.struts2.jquery</groupId>
<artifactId>struts2-jquery-plugin</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>com.jgeppert.struts2.jquery</groupId>
<artifactId>struts2-jquery-grid-plugin</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>com.jgeppert.struts2.jquery</groupId>
<artifactId>struts2-jquery-richtext-plugin</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.16</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh-plugin</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>concurrent</groupId>
<artifactId>concurrent</artifactId>
<version>1.3.4</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.0.4</version>
</dependency>
</dependencies>
You need to exclude the spring dependencies from the struts 2 spring plugin if you're going to use a different version than it requires.

Resources