Bất cứ khi nào cố gắng chạy mvn install
, trên một dự án Spring Boot xây dựng thất bại do:Cấu hình mùa xuân Boot với Xuân An làm xây dựng không thành công do tham chiếu đến thiếu phụ thuộc
<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>
Không thể thực hiện mục tiêu org .apache.maven.plugins: maven-compiler-plugin: 3.3: biên dịch (mặc định biên dịch) trên wave dự án: Lỗi nghiêm trọng biên dịch: java.lang.RuntimeException: com.sun.tools.javac.code.Symbol $ CompletionFailure: tệp lớp cho org.springframework.security.ldap.DefaultSpringS ecurityContextSource không tìm thấy -> [Help 1]
Hai điều giải quyết vấn đề này:
Xóa cấu hình bảo mật sau
@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); } }
Trong coruse, loại bỏ cấu hình không phải là một tùy chọn vì nó vô hiệu hóa bảo mật từ ứng dụng của tôi ion
Thêm phụ thuộc sau
<dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-ldap</artifactId> </dependency>
Tuy nhiên, trong khi thêm nó làm cho các lỗi biến mất, một lỗi mới tương tự (chỉ trỏ đến khác lớp học) đã xuất hiện:
Không thể thực hiện mục tiêu org.apache.maven.plugins: maven-compiler-plugin: 3.3: compile (mặc định biên dịch) trên wave dự án: Lỗi nghiêm trọng biên dịch: java.lang.RuntimeException: com.sun.tools.javac.code.Symbol $ CompletionFailure: tệp lớp cho org.springframework.security.openid.OpenIDAttribute not tìm thấy -> [Help 1]
sửa chữa này một lần nữa, tôi đã thêm các phụ thuộc sau:
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-openid</artifactId>
</dependency>
này cố định vấn đề này một lần nữa, nhưng lỗi khác xuất hiện:
Không thể thực hiện mục tiêu org.apache.maven.plugins: maven-biên dịch-plugin: 3.3: biên dịch (mặc định-biên dịch) trên làn sóng dự án: Fatal error biên soạn: java.lang.RuntimeException: com.sun .tools.javac.code.Symbol $ CompletionFailure: tệp lớp cho org.apache.http.HEADER không tìm thấy -> [Help 1]
Cuối cùng, thêm các phụ thuộc sau cố định tất cả các vấn đề:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.1</version>
</dependency>
Tuy nhiên, tôi bây giờ có nhiều phụ thuộc Tôi không sử dụng.
Có cách nào khác để khắc phục sự cố này không?
sửa chữa cuối cùng là gì? Tôi đang phải đối mặt với vấn đề tương tự. – Tamas