'Issue with Maven project in vs code
See the attached snapshots. I cloned this project and having issues working with this project in vs code:
https://github.com/javalite/jar-explorer
- Sometimes, the Maven tab or sub-view under the Explorer View is hidden. I did something that enable to section to show but I don't remember how. How I can show this Maven View if it is hidden?
- The project was built successfully using the command line
mvn clean install, however, the vs code problem view was showing strange errors. I then notice the the POM.xml file didn't have this line at the top:
<?xml version="1.0" encoding="UTF-8"?>
Following is a sample of the errors I saw:
CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1: ArtifactResolutionException: org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 failed to transfer from https://artifactory.xxx.dev/artifactory/clo-maven-dev during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from/to central (https://artifactory.xxx.dev/artifactory/clo-maven-dev): Access denied to https://artifactory.xxx.dev/artifactory/clo-maven-dev/org/apache/maven/plugins/maven-compiler-plugin/3.1/maven-compiler-plugin-3.1.pom. Error code 403,
Failed to read artifact descriptor for junit:junit:jar:4.13.1
...
...
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: junit:junit:pom:4.13.1 failed to transfer from https://artifactory.xxx.dev/artifactory/clo-maven-dev during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact junit:junit:pom:4.13.1 from/to central (https://artifactory.xxx.dev/artifactory/clo-maven-dev): Access denied to https://artifactory.xxx.dev/artifactory/clo-maven-dev/junit/junit/4.13.1/junit-4.13.1.pom. Error code 401,
MD :mvn --quiet clean -f "c:\Projects\jar-explorer-master\pom.xml" && mvn --quiet org.apache.maven.plugins:maven-dependency-plugin:3.0.2:tree -f "c:\Projects\jar-explorer-master\pom.xml" -DoutputFile="c:\Projects\jar-explorer-master\target\dependencies.txt" -DoutputType=dot -DappendOutput=true
STDOUT : [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project jarexplorer: Execution default-clean of goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean failed: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-clean-plugin:jar:2.5 -> org.codehaus.plexus:plexus-utils:jar:3.0: Failed to read artifact descriptor for org.codehaus.plexus:plexus-utils:jar:3.0: Could not transfer artifact org.codehaus.plexus:plexus-utils:pom:3.0 from/to central (https://artifactory.xxx.dev/artifactory/clo-maven-dev): authentication failed for https://artifactory.xxx.dev/artifactory/clo-maven-dev/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.pom, status: 401 Unauthorized -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
I then added the this line to POM.xml:
<?xml version="1.0" encoding="UTF-8"?>
... and opened the project using Eclipse, and execute the Maven Update Project, and the errors disappeared. I think there was some issue with authentication due to proxy issues. Now, I see only about 100 warnings, and I am able to build using vs code.
I also noticed that the following file was added under .settings folder when I executed Update from Eclipse:
org.eclipse.jdt.core.prefs
How I can add the above file org.eclipse.jdt.core.prefs using vs code?
How I can resolve the following warnings using vs code:
Build path specifies execution environment JavaSE-1.7. There are no JREs installed in the workspace that are strictly compatible with this environment.
The compiler compliance specified is 1.7 but a JRE 1.8 is used
Solution 1:[1]
- Ensure Maven is included in the Path Environment Variable:
$env:Path += ';C:\apache-maven-3.8.4\bin'
Reload window:
Shift+Ctrl+P and execute the command Reload Window.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |



