vscode-maven
vscode-maven copied to clipboard
Maven build fails when VSCode is open.
When I run command mvn clean install It gives a compilation error because AspectJ was unable to compile classes.
But when I run this above command when VSCode is closed and then run normally on terminal it works fine.
I know AspectJ doesn't support VSCode but it should be built my project when VSCode is open.
The error which I face is -
[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.11:compile (default) on project task-management: AJC compiler errors: [ERROR] error at import com.annotations.DataSourceSelector; [ERROR] /Users/b0224378/Documents/workspace/task-manager/src/main/java/com/config/datasource/DataSourceSelectorAspect.java:3:0::0 The import com.annotations.DataSourceSelector cannot be resolved
Environments:
- OS: MacOs Big sure 11.5.1
- VS Code version: 1.59.0
- Extension version v0.32.2
Pom.xml config-
I have also tried adding m2e execute onConfiguration,onIncremental in executions But it didn't work.
Is it possible that Java Language Server is doing something wrong? @testforstephen can you take a look?
Any updates?
Is it possible that Java Language Server is doing something wrong? @testforstephen can you take a look?
Looks like the autobuild of vscode-java extension conflicts with the command line mvn build. Can you try to change the user setting java.autobuild.enabled to false to see whether it works?
Yes, after setting java.autobuild.enabled to false, I ran mvn install and my build was successful.
I've also been seeing random build failures when running maven from the command line for some projects. Is this something that will be resolved at some point or is the only fix to disable autobuilds as per above?
For anyone stumbling upon this issue: This is the corresponding issue in the vscode-java plugin: redhat-developer/vscode-java#1381