1

I am totally new to Java Enterprise Edition and I am in early stages of the process of learning Java Servlet technology. This issue occured to me in the process of importing an existing Java web application example project to Eclipse Lunar Java EE IDE.

The imported application application project, projects errors during building of the workspace at the point of importing the project. The errors emitted are as follows.

Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'hello-world'.
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6

Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'hello-world'.
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6

I found plenty of posts referring to this particular issue which the developers have come across before but since this error occurs at the point of importing the project the depicted solutions do not provide a clear solution to my issue.

I did check my Maven configuration several times but it seems to work fine. I am using Java 1.8 and Maven 3.2.5 versions.

When I checked the pom.xml file of the sample project I imported, the error points to the following XML code fragment.

     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
            <source>1.8</source>
            <target>1.8</target>
        </configuration>
     </plugin>

The complete pom.xml file is as follows.

<?xml version="1.0" encoding="UTF-8"?>
<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.wrox</groupId>
    <artifactId>hello-world</artifactId>
    <version>1.0.0.SNAPSHOT</version>
    <packaging>war</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>source/production/java</sourceDirectory>
        <resources>
            <resource>
                <directory>source/production/resources</directory>
            </resource>
        </resources>

        <testSourceDirectory>source/test/java/unit</testSourceDirectory>
        <testResources>
            <testResource>
                <directory>source/test/java/resources</directory>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <warSourceDirectory>web</warSourceDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

I would be grateful to anyone who could provide me a detailed solution to this problem, since it is the first occasion I am confronting the usage of Maven dependencies and construction of Java web applications.

Chiranga Alwis
  • 1,049
  • 1
  • 25
  • 47
  • The error message states that a certain plugin dependency cannot be found. Could you add your complete pom.xml? – Magnilex Jun 07 '15 at 09:30
  • I have added it to my question. – Chiranga Alwis Jun 07 '15 at 09:33
  • Your pom looks ok. Have you manually configured which repositories to use? – Magnilex Jun 07 '15 at 09:58
  • In Eclipse when I reviewed my Preferences, I found that M2_REPO classpath variable has been already set to a location in my system. I did not set it up manually. – Chiranga Alwis Jun 07 '15 at 13:19
  • Should I set it up manually? – Chiranga Alwis Jun 07 '15 at 13:33
  • M2_REPO is just for Eclipse's access to your local repository. See [Guide to using Eclipse with Maven 2.x](https://maven.apache.org/guides/mini/guide-ide-eclipse.html). @Magnilex is referring to [Settings Reference, Servers](https://maven.apache.org/settings.html#Servers) and [POM Reference, Repositories](https://maven.apache.org/pom.html#Repositories). – Gerold Broser Jun 07 '15 at 13:58
  • possible duplicate of [Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved](http://stackoverflow.com/questions/12533885/could-not-calculate-build-plan-plugin-org-apache-maven-pluginsmaven-resources) – Gerold Broser Jun 07 '15 at 14:07
  • I just figured out some probable reasons for the above issue but I am not entirely sure about them. – Chiranga Alwis Jun 07 '15 at 19:31
  • 1
    1. In the User Settings under Maven in Windows --> Preferences in Eclipse the existing path refers to a settings.xml file that does not seem to exist in the specified location. A settings.xml exists in conf folder of Maven installation. 2. settings.xml file has most of almost all its coding commented including the and Could this be the reason? Should I edit and configure the settings.xml file? I would be grateful to any help since I am new on Maven... – Chiranga Alwis Jun 07 '15 at 19:39

0 Answers0