James
James

Reputation: 335

Maven-resources-plugin error

I ran mvn clean install command on my project and I was getting the below error. This is a java web project . Can you please let me know what is the cause of this problem. Thanks in advance

enter image description here

Below is my 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>eidmsidf.un.org.Contactus</groupId>
      <artifactId>Contactus</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>war</packaging>
      <build>
        <sourceDirectory>src</sourceDirectory>
        <resources>
          <resource>
            <directory>src</directory>
            <excludes>
              <exclude>**/*.java</exclude>
            </excludes>
          </resource>
        </resources>
        <plugins>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.0.0</version>
            <configuration>
              <warSourceDirectory>${basedir}/src/main/webapp/</warSourceDirectory>
            </configuration>
          </plugin>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.7</version>
              <dependencies>
                <dependency>
                    <groupId>org.apache.maven.shared</groupId>
                    <artifactId>maven-filtering</artifactId>
                    <version>1.3</version>
                </dependency>
              </dependencies>
            </plugin>
        </plugins>
      </build>
      <dependencies>
            <!-- <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> 
                <version>${jackson.version}</version> </dependency> -->
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>1.2.17</version>
            </dependency>
            <dependency>
                <groupId>org.apache.axis</groupId>
                <artifactId>axis</artifactId>
                <version>1.4</version>
            </dependency>
            <dependency>
                <groupId>commons-beanutils</groupId>
                <artifactId>commons-beanutils</artifactId>
                <version>1.8.0</version>
            </dependency>
            <dependency>
                <groupId>commons-collections</groupId>
                <artifactId>commons-collections</artifactId>
                <version>3.2.2</version>
            </dependency>
            <dependency>
                <groupId>commons-discovery</groupId>
                <artifactId>commons-discovery</artifactId>
                <version>0.2</version>
            </dependency>
            <dependency>
                <groupId>commons-fileupload</groupId>
                <artifactId>commons-fileupload</artifactId>
                <version>1.3.2</version>
            </dependency>
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>2.2</version>
            </dependency>
            <dependency>
                <groupId>commons-lang</groupId>
                <artifactId>commons-lang</artifactId>
                <version>2.4</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>3.2</version>
            </dependency>
            <dependency>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
                <version>1.1.1</version>
            </dependency>
            <dependency>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
                <version>1.1.3</version>
            </dependency>
            <dependency>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging-api</artifactId>
                <version>1.1</version>
            </dependency>
            <dependency>
                <groupId>displaytag</groupId>
                <artifactId>displaytag</artifactId>
                <version>1.2</version>
            </dependency>
            <dependency>
                <groupId>displaytag</groupId>
                <artifactId>displaytag-export-poi</artifactId>
                <version>1.2</version>
            </dependency>
            <dependency>
                <groupId>displaytag</groupId>
                <artifactId>displaytag-portlet</artifactId>
                <version>1.2</version>
            </dependency>
            <dependency>
                <groupId>org.freemarker</groupId>
                <artifactId>freemarker</artifactId>
                <version>2.3.22</version>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpcore</artifactId>
                <version>4.0.1</version>
            </dependency>
            <dependency>
                <groupId>javassist</groupId>
                <artifactId>javassist</artifactId>
                <version>3.0</version>
            </dependency>
            <dependency>
                <groupId>javassist</groupId>
                <artifactId>javassist</artifactId>
                <version>3.11.0.GA</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish</groupId>
                <artifactId>javax.json</artifactId>
                <version>1.0.4</version>
            </dependency>
            <dependency>
                <groupId>javax.json</groupId>
                <artifactId>javax.json-api</artifactId>
                <version>1.0</version>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>3.1.0</version>
            </dependency>
            <dependency>
                <groupId>javax.xml</groupId>
                <artifactId>jaxrpc</artifactId>
                <version>1.1</version>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>jstl</artifactId>
                <version>1.2</version>
            </dependency>
            <dependency>
                <groupId>ognl</groupId>
                <artifactId>ognl</artifactId>
                <version>3.0.19</version>
            </dependency>
            <!-- <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> 
                <version>11.2.0.3</version> </dependency> -->
            <dependency>
                <groupId>net.tanesha.recaptcha4j</groupId>
                <artifactId>recaptcha4j</artifactId>
                <version>0.0.7</version>
            </dependency>

            <!-- <dependency> <groupId>nl.captcha</groupId> <artifactId>simplecaptcha</artifactId> 
                <version>1.2.1</version> </dependency> -->
            <dependency>
                <groupId>taglibs</groupId>
                <artifactId>standard</artifactId>
                <version>1.1.2</version>
            </dependency>
            <dependency>
                <groupId>org.apache.struts</groupId>
                <artifactId>struts2-core</artifactId>
                <version>2.3.30</version>
            </dependency>
            <dependency>
                <groupId>wsdl4j</groupId>
                <artifactId>wsdl4j</artifactId>
                <version>1.6.2</version>
            </dependency>
            <dependency>
                <groupId>org.apache.struts.xwork</groupId>
                <artifactId>xwork-core</artifactId>
                <version>2.3.30</version>
            </dependency>
            <dependency>
                    <groupId>com.oracle</groupId>
                    <artifactId>ojdbc6</artifactId>
                    <version>1.0</version>
                    <scope>system</scope>
                    <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/ojdbc6.jar</systemPath>
            </dependency> 
            <dependency>
                    <groupId>java</groupId>
                    <artifactId>javax.mail</artifactId>
                    <version>1.3.3.01</version>
                    <scope>system</scope>
                    <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/javax.mail-1.3.3.01.jar</systemPath>
            </dependency> 
        </dependencies>
    </project>

Upvotes: 0

Views: 3448

Answers (3)

Anshul Sharma
Anshul Sharma

Reputation: 3522

On Windows, there reasons for being unable to create a folder are:

Some other process is deleting this folder at the same time You don't have permissions to access this folder The folder is on a network share Network shares are notoriously unreliable on Windows. Don't use them for any automated tasks. Always build projects with all files residing on a local hard disk.

If you use Maven and Eclipse to build at the same time, you should configure them to use different target folders. See https://stackoverflow.com/a/54366009/34088

Your POM should look like this:

<project>
 ...

<build>
<outputDirectory>${basedir}/${target.dir}/classes</outputDirectory>
<testOutputDirectory>${basedir}/${target.dir}/test-
classes</testOutputDirectory>
</build>

<properties>
<target.dir>target</target.dir>
</properties>

<profiles>
<profile>
  <id>eclipse-folders</id>
  <properties>
    <target.dir>target-eclipse</target.dir>
  </properties>
 </profile>
  </profiles>

...

All that's left is to enable the profile eclipse-folders in the IDE.

Upvotes: 1

harshavmb
harshavmb

Reputation: 3872

There are two issues here.

  1. Some other process might be deleting the folder at the same time you run mvn
  2. You don't have enough privileges to write data to C:\GIT_REPOSITORIES\ directory.

If you have admin access, you can run mvn clean install as an admin from cmd prompt. Else, get enough permissions to write data to the above mentioned directory.

Hope this helps!

Upvotes: 1

Mike Adamenko
Mike Adamenko

Reputation: 3002

As mentioned in the exception, maven can't create directory. Try to create this directory manually to ensure that path is valid and you have enough rights.

Upvotes: 1

Related Questions