Nithya
Nithya

Reputation: 644

Error shown when creating new Maven project in Eclipse

When I am trying to create new project on Maven in eclipse IDE ,It shows the following errors:

"Could not get the value for parameter encoding for plugin execution default-resources Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-resources-plugin:jar:2.5 ()"

Anyone please tell what I have to do?

can anyone tell me the steps to create Spring project with Maven enabled?

POM.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.spring</groupId>
  <artifactId>SpringMaven</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>SpringMaven</name>
</project>

Upvotes: 12

Views: 51136

Answers (4)

specialk1st
specialk1st

Reputation: 1727

The following steps worked for me:

  1. Close Eclipse.
  2. Navigate to user home directory. (For example: "C:\Users\YourUserName\.m2")
  3. Delete the "repository" folder.
  4. Re-open Eclipse.
  5. Click on the Maven project that has an issue and go to "Project" --> "Clean".
  6. Right-click on the project and go to "Maven" --> "Update Project...".
  7. Close Eclipse.
  8. Open Eclipse.
  9. Click on the project folder in the "Project Explorer" window (usually on the left).
  10. Hit the F5 key a few times to Refresh your project.
  11. Done!

These steps worked for me. If this works for you make sure to upvote, otherwise drop a comment.

Upvotes: 46

user6833385
user6833385

Reputation: 1

  1. close eclipse, delete the .m2 folder
  2. go to "https://repo.maven.apache.org/maven2" and download the certificate and install certificate by using "keytool" for more detail google it.
  3. open eclipse and update existing maven project.
  4. Now try creating maven project, it should be fine now.

Upvotes: 0

smwikipedia
smwikipedia

Reputation: 64205

I had similar issue. Below is my detailed error message:

Could not get the value for parameter encoding for plugin execution default-resources Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven:maven-plugin-api:jar:2.0.6, org.apache.maven:maven-project:jar:2.0.6, org.apache.maven:maven-profile:jar:2.0.6, org.apache.maven:maven-artifact-manager:jar:2.0.6, org.apache.maven:maven-plugin-registry:jar:2.0.6, org.apache.maven:maven-core:jar:2.0.6, org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6, org.apache.maven:maven-repository-metadata:jar:2.0.6, org.apache.maven:maven-error-diagnostics:jar:2.0.6, org.apache.maven:maven-plugin-descriptor:jar:2.0.6, classworlds:classworlds:jar:1.1, org.apache.maven:maven-artifact:jar:2.0.6, org.apache.maven:maven-settings:jar:2.0.6, org.apache.maven:maven-model:jar:2.0.6, org.apache.maven:maven-monitor:jar:2.0.6: Failure to transfer org.apache.maven:maven-plugin-api:jar:2.0.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:maven-plugin-api:jar:2.0.6 from/to central (https://repo.maven.apache.org/maven2): connect timed out

From the first look, it seems the connection to the central repository failed. But actually it turns out something is f**ked up in my local repository.

Rather than spend time to figuring out what's wrong with my 10G local repository, I use an empty folder as the new local repository.

And error is gone.

This is not a solution. This is just a workaround.

I think maven is not robust enough when local repository gets big. And the misleading error message has wasted me a lot of time to check network or proxy issue. Hope it can save other souls some time.

BTW: Apache Maven Cookbook 2015 is a very good book for Maven starters.

ADD 1

The chosen answer did essentially similar things to mine.

Upvotes: 1

Ankit
Ankit

Reputation: 3183

Delete maven resource plugin jars (delete the whole folder) from this location - {user.home}.m2\repository\org\apache\maven\plugins\maven-resources-plugin and then try to rebuild again.

Upvotes: 2

Related Questions