Maven-resources-plugin错误

时间:2017-06-28 17:50:14

标签: java maven

我在我的项目上运行了mvn clean install命令,我收到了以下错误。这是一个java web项目。你能告诉我这个问题的原因是什么吗?提前致谢

enter image description here

下面是我的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>

3 个答案:

答案 0 :(得分:1)

如异常中所述,maven无法创建目录。尝试手动创建此目录以确保路径有效并且您有足够的权限。

答案 1 :(得分:1)

在Windows上,无法创建文件夹的原因是:

其他一些进程正在同时删除此文件夹 您无权访问此文件夹 该文件夹位于网络共享上 在Windows上,网络共享是出了名的不可靠。不要将它们用于任何自动化任务。始终使用驻留在本地硬盘上的所有文件构建项目。

如果您同时使用Maven和Eclipse进行构建,则应将它们配置为使用不同的目标文件夹。见https://stackoverflow.com/a/54366009/34088

你的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>

...

剩下的就是在IDE中启用配置文件eclipse-folders。

答案 2 :(得分:1)

这里有两个问题。

  1. 其他一些进程可能会在您运行mvn
  2. 的同时删除该文件夹
  3. 您没有足够的权限将数据写入C:\GIT_REPOSITORIES\目录。
  4. 如果您具有管理员权限,则可以从cmd提示符作为管理员运行mvn clean install。否则,获得足够的权限将数据写入上述目录。

    希望这有帮助!