gpt4 book ai didi

grails - Grails和Maven集成

转载 作者:行者123 更新时间:2023-12-02 14:20:26 25 4
gpt4 key购买 nike

我正在尝试将Grails和Maven集成到现有的grails项目中。
但这引发了异常

maven-test (default) on project Co-optimum: Unable to start Grails:    java.lang.reflect.InvocationTargetException: org/springframework/security/web/authentication/LoginUrlAuthenticationEntryPoint: org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint

我的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.samples</groupId>
<artifactId>Co-optimum</artifactId>
<packaging>war</packaging>
<name>Co-optimum</name>
<properties>
<sourceComplianceLevel>1.6</sourceComplianceLevel>
</properties>
<version>0.1</version>

<dependencies>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.5.8</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>

<plugins>

<plugin>
<groupId>org.grails</groupId>
<artifactId>grails-maven-plugin</artifactId>
<version>1.3.7</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>config-directories</goal>
<goal>maven-compile</goal>
<goal>maven-test</goal>
<goal>maven-war</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>

</project>

最佳答案

Maven集成已在Grails 2.1.0中进行了重新设计,并且现在还需要在Maven pom文件中定义插件依赖项。以前,插件依赖项是使用BuildConfig.groovy或application.properties管理的。

您需要将所有插件和常规依赖项从BuildConfig.groovy和application.properties移至pom.file。

对于某些插件,可能需要使用标准Grails在pom中显式添加不需要的依赖项。但是从Maven启动Grails时,从错误日志中可以清楚地看出这一点。

具体来说,您缺少对Spring安全性插件的依赖关系,需要将以下XML片段添加到依赖关系列表中:

       <dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>spring-security-core</artifactId>
<version>1.2.7.3</version>
<scope>compile</scope>
<type>zip</type>
</dependency>

您还需要通过将以下片段添加到pom文件来确保Grails maven存储库可用:
<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>

关于grails - Grails和Maven集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11951581/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com