I am trying to use Spring Security in a project where I use eclipselink as the modelgen processor to generate the static meta model. When I try to do this I get strange compilation errors like:
> java.lang.RuntimeException: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for org.springframework.security.ldap.DefaultSpringSecurityContextSource not found
even though I do not use LDAP. If I add the jars I get other errors like missing sl4j, missing openid, etc etc. If I exchange the used modelgen processor with the hibernate implementation everything compiles without problems.
I found a minimal project to reproduce the problem:
MyEnity.java
@Entity
public class MyEntity {
private String name;
private Long id;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
SecurityConfig.java
public class SecurityConfig extends WebSecurityConfigurerAdapter {
}
build.gradle
apply plugin: 'war'
apply plugin: 'maven'
group = 'com.demo'
version = 'alpha'
sourceCompatibility = 1.8
targetCompatibility = 1.8
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
repositories {
maven { url "http://repo.maven.apache.org/maven2" }
maven { url "http://download.eclipse.org/rt/eclipselink/maven.repo/" }
}
dependencies {
compile 'org.eclipse.persistence:org.eclipse.persistence.jpa.modelgen.processor:2.6.0'//latest stable @06.07.2015
compile "org.springframework:spring-beans:4.1.6.RELEASE"
compile "org.springframework:spring-core:4.1.6.RELEASE"
compile "org.springframework:spring-web:4.1.6.RELEASE"
compile "org.springframework:spring-context:4.1.6.RELEASE"
compile 'org.springframework:spring-jdbc:4.1.6.RELEASE'
compile 'org.springframework.security:spring-security-core:4.0.2.RELEASE'
compile 'org.springframework.security:spring-security-web:4.0.2.RELEASE'
compile 'org.springframework.security:spring-security-config:4.0.2.RELEASE'
providedCompile 'javax:javaee-api:7.0@jar'
}
As soon as I remove
a) the @Entity from MyEntity
or
b) extends WebSecurityConfigurerAdapter from Security Config
or
c) use compile 'org.hibernate:hibernate-jpamodelgen:4.3.10.Final'
instead of compile 'org.eclipse.persistence:org.eclipse.persistence.jpa.modelgen.processor:2.6.0'
everything compiles without problems.
So why does the use of the eclipselink modelgen processor cause compilation errors?