Whenever trying to run mvn install, on a Spring Boot project the build fails due to:
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jersey</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project wave: Fatal error compiling: java.lang.RuntimeException: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for org.springframework.security.ldap.DefaultSpringSecurityContextSource not found -> [Help 1]
Two things solved this issue:
Deleting the following security configuration
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
  @Inject
  private UserDetailsService userDetailsService;
  @Inject
  public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    auth
      .userDetailsService(userDetailsService);
  }
  @Override
  protected void configure(HttpSecurity http) throws Exception {
    http
      .httpBasic()
        .realmName("Wave")
        .and()
      .authorizeRequests()
        .antMatchers(HttpMethod.POST, "/wave/service/employees/**").anonymous()
        .antMatchers("/wave/service/**").authenticated()
        .and()
      .sessionManagement()
        .sessionCreationPolicy(SessionCreationPolicy.STATELESS);
  }
}
Of coruse, removing the configuration is not an option since it disables security from my application
Adding the following dependency
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-ldap</artifactId>
</dependency>
However, while adding it made the error disappear, a new similar error (just pointing to another class) appeared:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project wave: Fatal error compiling: java.lang.RuntimeException: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for org.springframework.security.openid.OpenIDAttribute not found -> [Help 1]
Fixing this again, I added the following dependency:
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-openid</artifactId>
    </dependency>
This fixed the issue again, but another error appeared:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project wave: Fatal error compiling: java.lang.RuntimeException: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for org.apache.http.Header not found -> [Help 1]
Finally, adding the following dependency fixed all the issues:
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5.1</version>
    </dependency>
However, I now have multiple dependencies I am not using.
Is there another way to fix this issue?
I solved this problem by replacing
<dependency>
   <groupId>org.eclipse.persistence</groupId>
   <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
   <version>2.6.4</version>
   <scope>provided</scope>
</dependency>
on
<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-jpamodelgen</artifactId>
  <version>5.0.12.Final</version>
</dependency>
I think this problem in org.eclipse.persistence.jpa.modelgen.processor
remove your dependency and add this; this works fine for me after i have removed
<dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5.1</version>
    </dependency>
'
and
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
here is my pom.xml file
    <dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
        <exclusions>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>            
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.security.oauth</groupId>
        <artifactId>spring-security-oauth2</artifactId>
        <version>2.0.9.RELEASE</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.6</version>
    </dependency>
</dependencies>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With