使用maven解析grails插件时无法解析构建扩展



我正在尝试使用maven编译一个grails项目。我得到以下错误

[INFO] Scanning for projects...
[WARNING] The POM for org.grails.plugins:kickstart-with-bootstrap:jar:1.1.0 is missing, no dependency information available
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.test:temp2:0.1 (/mnt/data/Work/Tutorials/Practice/grails/temp2/pom.xml) has 2 errors
[ERROR]     Unresolveable build extension: Plugin org.grails.plugins:kickstart-with-bootstrap:1.1.0 or one of its dependencies could not be resolved: Failure to find org.grails.plugins:kickstart-with-bootstrap:jar:1.1.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 2]
[ERROR]     Unknown packaging: grails-app @ line 9, column 16
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

错误是这样的,我甚至不能生成依赖树。我附上我的pom.xml。谁能告诉我我哪里做错了?

<?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.test</groupId>
    <artifactId>temp2</artifactId>
    <packaging>grails-app</packaging>
    <version>0.1</version>
    <name>temp2</name>
    <description>temp2</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>
    </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>
            <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.5</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.3</version>
            <configuration>
                <grailsVersion>${grails.version}</grailsVersion>
            </configuration>
            <extensions>true</extensions>
        </plugin>
        <plugin>
            <groupId>org.grails.plugins</groupId>
            <artifactId>kickstart-with-bootstrap</artifactId>
            <version>1.1.0</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>

这里有两个实现不正确:

  1. kickstart-with-bootstrap 是grails 插件依赖项,因此它应该在pom.xml<dependencies>部分下,而不是maven插件。

  2. Grails插件被打包为zip而不是jar,所以依赖项的<type>应该是zip

解决方案:

删除这部分

<plugin>
     <groupId>org.grails.plugins</groupId>
     <artifactId>kickstart-with-bootstrap</artifactId>
     <version>1.1.0</version>
     <configuration>
         <grailsVersion>${grails.version}</grailsVersion>
     </configuration>
     <extensions>true</extensions>
</plugin>

并在<dependencies>

下添加此部分
<dependency>
    <groupId>org.grails.plugins</groupId>
    <artifactId>kickstart-with-bootstrap</artifactId>
    <version>1.1.0</version>
    <type>zip</zip>
</dependency>

相关内容

  • 没有找到相关文章

最新更新