简体   繁体   English

无法创建Grails服务

[英]Unable to create Grails Service

From IntelliJ Idea version 14, In my Grails App (which is a maven project), I do 从IntelliJ Idea版本14开始,在我的Grails应用程序(这是一个maven项目)中,

Right Click on Services -> New -> Grails Service 右键单击服务->新建-> Grails服务

I get the following error on my console 我在控制台上收到以下错误

The plugin org.grails:grails-maven-plugin:2.4.4 requires Maven version 3.1.0 插件org.grails:grails-maven-plugin:2.4.4需要Maven版本3.1.0

From Terminal when I check my maven version it is 3.3 从终端检查我的Maven版本是3.3

mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T17:27:37+05:30)
Maven home: /opt/software/apache-maven
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /opt/software/jdk1.7.0_79/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-61-generic", arch: "amd64", family: "unix"

Pom.xml (Just relevant parts for reference) Pom.xml(仅供参考)

<properties>
        <grails.version>2.4.4</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>log4j</groupId>
            <artifactId>apache-log4j-extras</artifactId>
            <version>1.1</version>
            <scope>compile</scope>


        </dependency>

        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.10</version>
            <scope>compile</scope>


        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.29</version>
            <scope>runtime</scope>


        </dependency>

        <dependency>
            <groupId>org.grails</groupId>
            <artifactId>grails-datastore-test-support</artifactId>
            <version>1.0.2-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.8</version>
            <scope>compile</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>asset-pipeline</artifactId>
            <version>1.9.9</version>
            <scope>compile</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>quartz</artifactId>
            <version>1.0.2</version>
            <scope>compile</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>rest</artifactId>
            <version>0.8</version>
            <scope>compile</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>excel-export</artifactId>
            <version>0.2.1</version>
            <scope>compile</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>grails-melody</artifactId>
            <version>1.55.0</version>
            <scope>compile</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>2.0-RC4</version>
            <scope>compile</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>console</artifactId>
            <version>1.5.1</version>
            <scope>compile</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>hibernate4</artifactId>
            <version>4.3.6.1</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>mail</artifactId>
            <version>1.0.7</version>
            <scope>runtime</scope>

            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>tomcat</artifactId>
            <version>7.0.55</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>
                <version>2.18.1</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.0</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.4</version>
                <configuration>
                    <grailsVersion>${grails.version}</grailsVersion>
                </configuration>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>grails</id>
            <name>grails</name>
            <url>https://repo.grails.org/grails/core</url>
        </repository>
        <repository>
            <id>grails-plugins</id>
            <name>grails-plugins</name>
            <url>https://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>

Your IntelliJ is using the bundled Maven. 您的IntelliJ正在使用捆绑的Maven。

File > Settings (Ctrl+Alt+S), search maven, then change your Maven home directory to the one in the terminal. 文件>设置(Ctrl + Alt + S),搜索maven,然后将Maven主目录更改为终端中的目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM