0

我收到这个 maven clean 错误,错误org.apache.maven.plugins

maven-clean-plugin:2.4.1:clean 无法删除 C:\Users\Hobbs\git\heroku\reservosity\target\tomcat.8080\work\Tomcat\localhost_\WEB-INF\lib\mysql-connector-java -5.1.20.jar

不知道为什么会这样。任何帮助,将不胜感激。

日志:

Apache Maven 3.0.4 (r1232337; 2012-01-17 08:44:56+0000)
Maven home: C:\Users\Hobbs\git\heroku\reservosity\EMBEDDED
Java version: 1.7.0_04, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jre7
Default locale: en_IE, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from EMBEDDED\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\Hobbs\.m2\settings.xml
[DEBUG] Using local repository at C:\Users\Hobbs\.m2\repository
 [DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for C:\Users\Hobbs\.m2\repository
    [INFO] Scanning for projects...
    [DEBUG] Extension realms for project com.example:Reservosity:war:0.0.1-SNAPSHOT: (none)
    [DEBUG] Looking up lifecyle mappings for packaging war from ClassRealm[plexus.core, parent: null]
 [WARNING] 
 [WARNING] Some problems were encountered while building the effective model for com.example:Reservosity:war:0.0.1-SNAPSHOT
 [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 232, column 12
 [WARNING] 
 [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
 [WARNING] 
 [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
 [WARNING] 
 [DEBUG] === REACTOR BUILD PLAN ================================================
 [DEBUG] Project: com.example:Reservosity:war:0.0.1-SNAPSHOT
 [DEBUG] Tasks:   [clean]
[DEBUG] Style:   Regular
[DEBUG] =======================================================================
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Reservosity 0.0.1-SNAPSHOT
 [INFO] ------------------------------------------------------------------------
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project:       com.example:Reservosity:0.0.1-SNAPSHOT
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): []
[DEBUG] Repositories (dependencies): [central (http://repo.maven.apache.org/maven2, releases)]
[DEBUG] Repositories (plugins)     : [central (http://repo.maven.apache.org/maven2, releases)]
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal:          org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean)
[DEBUG] Style:         Regular
    [DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <directory default-value="${project.build.directory}"/>
 <excludeDefaultDirectories default-value="false">${clean.excludeDefaultDirectories}     </excludeDefaultDirectories>
  <failOnError default-value="true">${maven.clean.failOnError}</failOnError>
   <followSymLinks default-value="false">${clean.followSymLinks}</followSymLinks>
    <outputDirectory default-value="${project.build.outputDirectory}"/>
   <reportDirectory default-value="${project.reporting.outputDirectory}"/>
   <skip default-value="false">${clean.skip}</skip>
   <testOutputDirectory default-value="${project.build.testOutputDirectory}"/>
   <verbose>${clean.verbose}</verbose>
   </configuration>
[DEBUG] =======================================================================
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ Reservosity ---
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG]   Imported: org.apache.maven.wagon.events < plexus.core
[DEBUG]   Imported: org.sonatype.aether.transfer < plexus.core
[DEBUG]   Imported: org.apache.maven.exception < plexus.core
[DEBUG]   Imported: org.sonatype.aether.metadata < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core
[DEBUG]   Imported: org.sonatype.aether.collection < plexus.core
 [DEBUG]   Imported: org.sonatype.aether.version < plexus.core
  [DEBUG]   Imported: org.apache.maven.monitor < plexus.core
  [DEBUG]   Imported: org.apache.maven.wagon.repository < plexus.core
  [DEBUG]   Imported: org.apache.maven.repository < plexus.core
 [DEBUG]   Imported: org.apache.maven.wagon.resource < plexus.core
 [DEBUG]   Imported: org.codehaus.plexus.logging < plexus.core
 [DEBUG]   Imported: org.apache.maven.profiles < plexus.core
[DEBUG]   Imported: org.sonatype.aether.repository < plexus.core
[DEBUG]   Imported: org.apache.maven.classrealm < plexus.core
[DEBUG]   Imported: org.apache.maven.execution < plexus.core
[DEBUG]   Imported: org.sonatype.aether.artifact < plexus.core
 [DEBUG]   Imported: org.sonatype.aether.spi < plexus.core
 [DEBUG]   Imported: org.apache.maven.reporting < plexus.core
 [DEBUG]   Imported: org.apache.maven.usability < plexus.core
 [DEBUG]   Imported: org.codehaus.plexus.container < plexus.core
 [DEBUG]   Imported: org.codehaus.plexus.component < plexus.core
 [DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core
 [DEBUG]   Imported: org.apache.maven.wagon.authentication < plexus.core
 [DEBUG]   Imported: org.apache.maven.lifecycle < plexus.core
 [DEBUG]   Imported: org.codehaus.plexus.classworlds < plexus.core
  [DEBUG]   Imported: org.sonatype.aether.graph < plexus.core
 [DEBUG]   Imported: org.sonatype.aether.* < plexus.core
 [DEBUG]   Imported: org.apache.maven.settings < plexus.core
 [DEBUG]   Imported: org.codehaus.classworlds < plexus.core
 [DEBUG]   Imported: org.sonatype.aether.impl < plexus.core
  [DEBUG]   Imported: org.apache.maven.wagon.* < plexus.core
  [DEBUG]   Imported: org.apache.maven.toolchain < plexus.core
 [DEBUG]   Imported: org.sonatype.aether.deployment < plexus.core
  DEBUG]   Imported: org.apache.maven.wagon.observers < plexus.core
  [DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core
  [DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core
 [DEBUG]   Imported: org.apache.maven.configuration < plexus.core
  [DEBUG]   Imported: org.apache.maven.cli < plexus.core
  [DEBUG]   Imported: org.sonatype.aether.installation < plexus.core
  [DEBUG]   Imported: org.codehaus.plexus.context < plexus.core
  [DEBUG]   Imported: org.apache.maven.wagon.authorization < plexus.core
 [DEBUG]   Imported: org.apache.maven.project < plexus.core
 [DEBUG]   Imported: org.apache.maven.rtinfo < plexus.core
  [DEBUG]   Imported: org.codehaus.plexus.lifecycle < plexus.core
  [DEBUG]   Imported: org.codehaus.plexus.configuration < plexus.core
  [DEBUG]   Imported: org.apache.maven.artifact < plexus.core
  [DEBUG]   Imported: org.apache.maven.model < plexus.core
   [DEBUG]   Imported: org.apache.maven.* < plexus.core
  [DEBUG]   Imported: org.apache.maven.wagon.proxy < plexus.core
    [DEBUG]   Imported: org.sonatype.aether.resolution < plexus.core
   [DEBUG]   Imported: org.apache.maven.plugin < plexus.core
   [DEBUG]   Imported: org.codehaus.plexus.* < plexus.core
       [DEBUG]   Imported: org.codehaus.plexus.personality < plexus.core
      [DEBUG] Populating class realm maven.api
     [DEBUG] org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1:
      [DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0.6:compile
      [DEBUG]    org.codehaus.plexus:plexus-utils:jar:2.0.5:compile
      [DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-clean-plugin:2.4.1
      [DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-clean-plugin:2.4.1
     [DEBUG]   Imported:  < maven.api
     [DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-clean-plugin:2.4.1
     [DEBUG]   Included: org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1
     [DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:2.0.5
     [DEBUG]   Excluded: org.apache.maven:maven-plugin-api:jar:2.0.6
       [DEBUG] Configuring mojo org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-clean-plugin:2.4.1, parent: sun.misc.Launcher$AppClassLoader@2d8ed284]
   [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean' with basic configurator -->
   [DEBUG]   (f) directory = C:\Users\Hobbs\git\heroku\reservosity\target
   [DEBUG]   (f) excludeDefaultDirectories = false
   [DEBUG]   (f) failOnError = true
   [DEBUG]   (f) followSymLinks = false
   [DEBUG]   (f) outputDirectory = C:\Users\Hobbs\git\heroku\reservosity\target\classes
   [DEBUG]   (f) reportDirectory = C:\Users\Hobbs\git\heroku\reservosity\target\site
   [DEBUG]   (f) skip = false
   [DEBUG]   (f) testOutputDirectory = C:\Users\Hobbs\git\heroku\reservosity\target\test-classes
   [DEBUG] -- end configuration --
  [INFO] Deleting C:\Users\Hobbs\git\heroku\reservosity\target
   [INFO] Deleting file C:\Users\Hobbs\git\heroku\reservosity\target\tomcat.8080\work\Tomcat\localhost\_\WEB-INF\lib\mysql-connector-java-5.1.20.jar
   [INFO] ------------------------------------------------------------------------
   [INFO] BUILD FAILURE
   [INFO] ------------------------------------------------------------------------
   [INFO] Total time: 0.408s
  [INFO] Finished at: Thu Feb 28 21:21:27 GMT 2013
  [INFO] Final Memory: 4M/121M
    [INFO] ------------------------------------------------------------------------
         [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-       plugin:2.4.1:clean (default-clean) on project Reservosity:
  Failed to clean project: Failed to delete C:\Users\Hobbs\git\heroku\reservosity\target\tomcat.8080\work\Tomcat\localhost 
   \_\WEB-INF\lib\mysql-connector-java-5.1.20.jar -> [Help 1]
   org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal   
  org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project
  Reservosity: Failed to clean project: Failed to delete C:\Users\Hobbs\git\heroku    \reservosity\target\tomcat.8080\work\Tomcat\localhost\_\WEB-INF\lib\mysql-connector-  java-5.1.20.jar

POM.xml:

<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>Reservosity</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>

<properties>
    <org.springframework.version>3.1.1.RELEASE</org.springframework.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.1.2</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>org.hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <version>2.2.8</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.20</version>
    </dependency>
    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
        <groupId>com.github.jsimone</groupId>
        <artifactId>webapp-runner</artifactId>
        <version>7.0.27.1</version>
        <scope>provided</scope>
    </dependency>


    <!-- Tiles dependency -->
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-core</artifactId>
        <version>3.0.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-jsp</artifactId>
        <version>3.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-api</artifactId>
        <version>2.2.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-servlet</artifactId>
        <version>3.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-template</artifactId>
        <version>3.0.1</version>
    </dependency>

    <!-- Security -->
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>3.1.3.RELEASE</version>
        <exclusions>
            <exclusion>
                <artifactId>spring-asm</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>3.1.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>3.1.3.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.1.9.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.3.1.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-c3p0</artifactId>
        <version>4.1.9.Final</version>
    </dependency>
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>2.1</version>
    </dependency>

    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.9.11</version>
    </dependency>
    <!-- Junit API -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.9.5</version>
    </dependency>


    <!-- JavaMail API -->
    <dependency>
        <groupId>javamail</groupId>
        <artifactId>javamail</artifactId>
        <version>1.3.3</version>
    </dependency>
    <!-- Java Activation -->
    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.1.1</version>
    </dependency>
    <!-- JavaMail extension -->
    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4.6-rc1</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.1</version>
    </dependency>
    <!-- slf4j-bridge for commons-logging -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>1.7.1</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.1</version>
    </dependency>

    <!-- The newrelic-agent.jar dependency. -->
    <dependency>
        <groupId>com.newrelic.agent.java</groupId>
        <artifactId>newrelic-agent</artifactId>
        <version>2.12.0</version>
        <scope>provided</scope>
    </dependency>
    <!-- The newrelic-api.jar dependency. -->
    <dependency>
        <groupId>com.newrelic.agent.java</groupId>
        <artifactId>newrelic-api</artifactId>
        <version>2.12.0</version>
        <scope>compile</scope>
    </dependency>
    <!-- The newrelic-java.zip dependency. -->
    <dependency>
        <groupId>com.newrelic.agent.java</groupId>
        <artifactId>newrelic-java</artifactId>
        <version>2.12.0</version>
        <scope>provided</scope>
        <type>zip</type>
    </dependency>
    <dependency>
        <groupId>aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>1.5.4</version>
    </dependency>
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.2</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.2</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.4</version>
            <executions>
                <execution>
                    <id>unpack-zip</id>
                    <phase>package</phase>
                    <goals>
                        <goal>unpack-dependencies</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>com.newrelic.agent.java</groupId>
                                <artifactId>newrelic-java</artifactId>
                                <version>theVersion</version>
                                <type>zip</type>
                                <overWrite>true</overWrite>
                                <outputDirectory>target</outputDirectory>
                                <destFileName>newrelic</destFileName>
                            </artifactItem>
                        </artifactItems>
                        <outputDirectory>/newrelic</outputDirectory>
                    </configuration>
                </execution>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>com.github.jsimone</groupId>
                                <artifactId>webapp-runner</artifactId>
                                <version>7.0.27.1</version>
                                <destFileName>webapp-runner.jar</destFileName>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

4

2 回答 2

4

如果文件因 Tomcat 仍在运行而被锁定,则可能会发生这种情况。

在尝试清理之前杀死 tomcat 进程。

于 2013-02-28T21:51:41.583 回答
0

它无法删除文件,具体来说C:\Users\Hobbs\git\heroku\reservosity\target\tomcat.8080\work\Tomcat\localhost\_\WEB-INF\lib\mysql-connector-java-5.1.20.jar,该文件是否仍在使用中,或者另一个 maven 或 java 进程正在运行?

于 2013-02-28T21:51:18.233 回答