无法弄清楚maven问题

时间:2014-09-04 07:35:50

标签: maven grails maven-plugin grails-maven grails-2.4

我是maven的新手,并试图学习它。我目前正在尝试使用maven构建我的grails应用程序。在编译pom时我遇到了这个错误

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

在阅读了一些maven文档并检查了maven中心站点后,我发现这个jar在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

如果有人知道我哪里出错了,请帮助我。

提前多多感谢。

1 个答案:

答案 0 :(得分:1)

我现在已经开始工作了。 grails-maven-plugin 2.4.2中有一个错误。升级到2.4.3解决了这个问题。感谢大家回复我的询问。