2014-09-04 110 views
0

我是新來的maven,並試圖學習它。我目前正在嘗試使用maven構建我的grails應用程序。在編譯的pom我得到這個錯誤無法找出maven問題

Failure to find org.codehaus.groovy:groovy-all:jar:2.4.2 in http://repo.grails.org/grails/core 

閱讀一些行家文檔和在檢查Maven的中央部位後,我發現這個罐子是不是可在Maven的中央位置。因此我決定用一個可用的jar來覆蓋這個依賴關係。但是我仍然得到同樣的錯誤。

我的POM文件是如下

<?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/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.mycompany</groupId> 
    <artifactId>grails-mongo-demo</artifactId> 
    <packaging>grails-app</packaging> 
    <version>0.1</version> 
    <name>grails-mongo-demo</name> 
    <description>grails-mongo-demo</description> 
    <properties> 
     <grails.version>2.4.2</grails.version> 
     <h2.version>1.3.170</h2.version> 
    </properties> 
    <dependencies> 
     <dependency> 
      <groupId>org.grails</groupId> 
      <artifactId>grails-dependencies</artifactId> 
      <version>${grails.version}</version> 
      <type>pom</type> 
     </dependency> 
     <dependency> 
      <groupId>org.grails</groupId> 
      <artifactId>grails-test</artifactId> 
      <version>${grails.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.grails</groupId> 
      <artifactId>grails-plugin-testing</artifactId> 
      <version>${grails.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.11</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.spockframework</groupId> 
      <artifactId>spock-core</artifactId> 
      <version>0.7-groovy-2.0</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.h2database</groupId> 
      <artifactId>h2</artifactId> 
      <version>${h2.version}</version> 
      <scope>runtime</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.grails</groupId> 
      <artifactId>grails-datastore-test-support</artifactId> 
      <version>1.0-grails-2.4</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.grails.plugins</groupId> 
      <artifactId>scaffolding</artifactId> 
      <version>2.1.2</version> 
      <scope>compile</scope> 
      <type>zip</type> 
     </dependency> 
     <dependency> 
      <groupId>org.grails.plugins</groupId> 
      <artifactId>cache</artifactId> 
      <version>1.1.7</version> 
      <scope>compile</scope> 
      <type>zip</type> 
     </dependency> 
     <dependency> 
      <groupId>org.grails.plugins</groupId> 
      <artifactId>asset-pipeline</artifactId> 
      <version>1.8.11</version> 
      <scope>compile</scope> 
      <type>zip</type> 
     </dependency> 
     <dependency> 
      <groupId>org.grails.plugins</groupId> 
      <artifactId>hibernate4</artifactId> 
      <version>4.3.5.4</version> 
      <scope>runtime</scope> 
      <type>zip</type> 
     </dependency> 
     <dependency> 
      <groupId>org.grails.plugins</groupId> 
      <artifactId>database-migration</artifactId> 
      <version>1.4.0</version> 
      <scope>runtime</scope> 
      <type>zip</type> 
     </dependency> 
     <dependency> 
      <groupId>org.grails.plugins</groupId> 
      <artifactId>jquery</artifactId> 
      <version>1.11.1</version> 
      <scope>runtime</scope> 
      <type>zip</type> 
     </dependency> 
     <dependency> 
      <groupId>org.grails.plugins</groupId> 
      <artifactId>tomcat</artifactId> 
      <version>7.0.54</version> 
      <scope>provided</scope> 
      <type>zip</type> 
     </dependency> 
     <dependency> 
      <groupId>org.grails.plugins</groupId> 
      <artifactId>webxml</artifactId> 
      <version>1.4.1</version> 
      <type>zip</type> 
      <scope>runtime</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.codehaus.groovy</groupId> 
      <artifactId>groovy-all</artifactId> 
      <version>2.3.6</version> 
     </dependency> 
    </dependencies> 
    <build> 
     <pluginManagement /> 
     <plugins> 
      <!-- Disables the Maven surefire plugin for Grails applications, as we have our own test runner --> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.17</version> 
       <configuration> 
        <skip>true</skip> 
       </configuration> 
       <executions> 
        <execution> 
         <id>surefire-it</id> 
         <phase>integration-test</phase> 
         <goals> 
          <goal>test</goal> 
         </goals> 
         <configuration> 
          <skip>false</skip> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-clean-plugin</artifactId> 
       <version>2.4.1</version> 
       <configuration> 
        <filesets> 
         <fileset> 
          <directory>plugins</directory> 
          <includes> 
           <include>**/*</include> 
          </includes> 
          <followSymlinks>false</followSymlinks> 
         </fileset> 
        </filesets> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.grails</groupId> 
       <artifactId>grails-maven-plugin</artifactId> 
       <version>2.4.2</version> 
       <configuration> 
        <grailsVersion>${grails.version}</grailsVersion> 
       </configuration> 
       <extensions>true</extensions> 
      </plugin> 
     </plugins> 
    </build> 
    <repositories> 
     <repository> 
      <id>grails</id> 
      <name>grails</name> 
      <url>http://repo.grails.org/grails/core</url> 
     </repository> 
     <repository> 
      <id>grails-plugins</id> 
      <name>grails-plugins</name> 
      <url>http://repo.grails.org/grails/plugins</url> 
     </repository> 
    </repositories> 
    <profiles> 
     <profile> 
      <id>tools</id> 
      <activation> 
       <property> 
        <name>java.vendor</name> 
        <value>Sun Microsystems Inc.</value> 
       </property> 
      </activation> 
      <dependencies> 
       <dependency> 
        <groupId>com.sun</groupId> 
        <artifactId>tools</artifactId> 
        <version>${java.version}</version> 
        <scope>system</scope> 
        <systemPath>${java.home}/../lib/tools.jar</systemPath> 
       </dependency> 
      </dependencies> 
     </profile> 
    </profiles> 
</project> 

而我得到的錯誤如下:

[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building grails-mongo-demo 0.1 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ grails-mongo-demo --- 
[INFO] 
[INFO] --- grails-maven-plugin:2.4.2:clean (default-clean) @ grails-mongo-demo --- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 1.968 s 
[INFO] Finished at: 2014-09-04T12:56:22+05:30 
[INFO] Final Memory: 8M/102M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.grails:grails-maven-plugin:2.4.2:clean (default-clean) on project grails-mongo-demo: Failed to create classpath for Grails execution. Failure to find org.codehaus.groovy:groovy-all:jar:2.4.2 in http://repo.grails.org/grails/core was cached in the local repository, resolution will not be reattempted until the update interval of grails has elapsed or updates are forced -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 

如果有任何人知道我錯了,請幫助我。

非常感謝。

+0

剛從您的pom中刪除了您的存儲庫條目。 – khmarbaise 2014-09-04 07:53:33

+0

您可以更具體地瞭解如何做到這一點。我對於maven來說並不陌生 – Rammohan 2014-09-04 07:55:24

回答

1

我已經得到它的工作了。 grails-maven-plugin 2.4.2中有一個bug。升級到2.4.3解決了這個問題。感謝大家迴應我的查詢。