简体   繁体   English

Maven-资源-插件错误

[英]Maven-resources-plugin error

I ran mvn clean install command on my project and I was getting the below error. 我在项目上运行了mvn clean install命令,但出现以下错误。 This is a java web project . 这是一个Java Web项目。 Can you please let me know what is the cause of this problem. 您能否让我知道造成此问题的原因。 Thanks in advance 提前致谢

在此处输入图片说明

Below is my pom.xml 下面是我的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>

As mentioned in the exception, maven can't create directory. 如异常中所述,maven无法创建目录。 Try to create this directory manually to ensure that path is valid and you have enough rights. 尝试手动创建此目录,以确保路径有效并且您具有足够的权限。

On Windows, there reasons for being unable to create a folder are: 在Windows上,无法创建文件夹的原因有:

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. 其他一些过程将同时删除此文件夹。您没有访问此文件夹的权限。该文件夹位于网络共享上。众所周知,网络共享在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. 如果同时使用Maven和Eclipse进行构建,则应将它们配置为使用不同的目标文件夹。 See https://stackoverflow.com/a/54366009/34088 参见https://stackoverflow.com/a/54366009/34088

Your POM should look like this: 您的POM应该如下所示:

<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. 剩下的就是在IDE中启用配置文件eclipse文件夹。

There are two issues here. 这里有两个问题。

  1. Some other process might be deleting the folder at the same time you run mvn 其他一些过程可能是在运行mvn的同时删除文件夹
  2. You don't have enough privileges to write data to C:\\GIT_REPOSITORIES\\ directory. 您没有足够的权限将数据写入C:\\GIT_REPOSITORIES\\目录。

If you have admin access, you can run mvn clean install as an admin from cmd prompt. 如果您具有管理员访问权限,则可以从cmd提示符下以管理员身份运行mvn clean install Else, get enough permissions to write data to the above mentioned directory. 否则,获得足够的权限将数据写入上述目录。

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM