4

I am using IntelliJ IDEA, and I have try to install the dependencies by maven but it gave me these error:

Cannot resolve plugin org.apache.maven.plugins:maven-clean-plugin:3.0.0
Cannot resolve plugin org.apache.maven.plugins:maven-resources-plugin:3.0.1
Cannot resolve plugin org.apache.maven.plugins:maven-jar-plugin:3.0.2
Cannot resolve plugin org.apache.maven.plugins:maven-compiler-plugin:3.7.0
Cannot resolve plugin org.apache.maven.plugins:maven-surefire-plugin:2.20.1
Cannot resolve plugin org.apache.maven.plugins:maven-site-plugin:3.6

I have search about similar question but they all refer to proxy problem but,

I can reach these plugin by browser without proxy and i also try to configure proxy in IntelliJ IDEA but its not working too.

Log file :

java.lang.RuntimeException: org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-site-plugin:3.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-site-plugin:jar:3.6 
 at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:117)  
 at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.resolvePlugin(Maven3XServerEmbedder.java:1119)  
 at jdk.internal.reflect.GeneratedMethodAccessor36.invoke(Unknown Source) 
 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
 at java.base/java.lang.reflect.Method.invoke(Method.java:566)  
 at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)  
 at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)  
 at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)  
 at java.base/java.security.AccessController.doPrivileged(Native Method)  
 at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)  
 at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562) 
 at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796) 
 at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677) 
 at java.base/java.security.AccessController.doPrivileged(Native Method)  
 at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)  
 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 
 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 
 at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.lang.RuntimeException: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven.plugins:maven-site-plugin:jar:3.6 
 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:255)  
 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:171) 
 at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:250) 
 at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:103)   ... 17 more Caused by: java.lang.RuntimeException: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-site-plugin:pom:3.6 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-site-plugin:pom:3.6 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org 
 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:423)  
 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:225) 
 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:202)  
 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:240)   ... 20 more Caused by: java.lang.RuntimeException: org.eclipse.aether.transfer.ArtifactTransferException: Failure to transfer org.apache.maven.plugins:maven-site-plugin:pom:3.6 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-site-plugin:pom:3.6 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org 
 at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:226) 
 at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:192)  
 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:564)  
 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:482) 
 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:400)   ... 23 more

error in the image

after compiling and building it successfully by intellij and by bash still two error exist

Cannot resolve plugin org.apache.maven.plugins:maven-clean-plugin:3.0.0
Cannot resolve plugin org.apache.maven.plugins:maven-site-plugin:3.6

what dose that mean and how to fix the remaining error in reading dependencies ?

Abd Al Rahman
  • 121
  • 2
  • 9
  • See https://stackoverflow.com/a/42427510/104891. What errors do you see in [idea.log](https://intellij-support.jetbrains.com/hc/articles/207241085)? Did you configure the proxy for Maven per https://maven.apache.org/guides/mini/guide-proxies.html ? – CrazyCoder Aug 28 '19 at 20:45
  • i have update the question with lg file and i will take a look to your links – Abd Al Rahman Aug 28 '19 at 20:53
  • Make sure you can build without errors from the command line and the proxy is set correctly for Maven. – CrazyCoder Aug 28 '19 at 20:54
  • i have configure proxy in : setting -> appearance & behavoir -> system settings -> http proxy not in setting.xml – Abd Al Rahman Aug 28 '19 at 20:55
  • 1
    This will not affect Maven, you must configure it in settings.xml: https://maven.apache.org/guides/mini/guide-proxies.html. Does it build from the command line outside of IntelliJ IDEA? – CrazyCoder Aug 28 '19 at 20:56
  • i can build without error, so what that mean ? why gave me error while read dependencies ? – Abd Al Rahman Aug 28 '19 at 20:58
  • Does IntelliJ IDEA use the same Maven and JDK versions and the same `settings.xml`? – CrazyCoder Aug 28 '19 at 21:01
  • i think that yes, but how to check that ? – Abd Al Rahman Aug 28 '19 at 21:04
  • See these screenshots, use the same JDK/Maven versions as work for you in the command line. If the issue persists, please share the [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) (project directory zipped) and all the logs: https://uploads.services.jetbrains.com/. https://i.imgur.com/4GXshiB.png https://i.imgur.com/Cpp4hWP.png https://i.imgur.com/9JDex5T.png – CrazyCoder Aug 28 '19 at 21:08
  • after compiling and building it successfully by intellij and by bash and return to import dependencies , still two error of previous 6 error : Cannot resolve plugin org.apache.maven.plugins:maven-clean-plugin:3.0.0 Cannot resolve plugin org.apache.maven.plugins:maven-site-plugin:3.6 i will update the question , but what does that mean ? – Abd Al Rahman Aug 28 '19 at 22:24
  • Please read the previous comment regarding the logs and the [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – CrazyCoder Aug 28 '19 at 22:51
  • What is your version of IntelliJ ? The recent 2019.2 had some problems with maven. I think that it's fixes in the 2019.2.1 - If you have the latest version, have you enabled the maven auto-import ? Have you tried an invalidate & restart ? Can you find the plugins in your local m2 repo ? – Arnaud Claudel Aug 28 '19 at 22:54
  • my intellij version is 2019.2.1, the maven auto-import is disabled now, i have tried to invalidate & restart and still the remaining two error in reading dependencies , and yes all the plugin that i face problem with is exist in .m2 repo although clean and site plugin – Abd Al Rahman Aug 28 '19 at 23:19
  • @AbdAlRahman any updates on the repro info asked above? – CrazyCoder Aug 29 '19 at 22:46
  • i have update the question with last update, every thing work correctly and the plugin exist in .m2 but still gave me error when importing maven dependencies, does any thing i must do for question ? – Abd Al Rahman Aug 30 '19 at 13:37
  • @AbdAlRahman zip and share a sample project to reproduce the issue and the logs folder from the IDE. – CrazyCoder Aug 30 '19 at 17:35

1 Answers1

0

I think you need to put your plugins inside tag <build> instead of tag <dependencies>. Something like:

<dependencies>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

See more info here

Oleg Spiridonov
  • 116
  • 1
  • 6