2010-01-15 69 views
0

我创建了一个grails 1.2.0项目,使用了acegi插件0.5.2,这非常有效。未添加到Maven的Grails acegi插件类

要将项目整合到我们公司的基础架构中,我需要通过maven构建它。所以我使用grails maven integration将其转换为maven项目,这些工作也非常好。

有一个问题:我有一个Java类CustomUserDetails,它实现了GrailsUser接口。当maven试图编译该项目时,它找不到接口类,它是acegi插件的一部分。

我是否错过了某些东西,或者是否存在导致类路径中缺少插件类的grails maven集成的问题?

更新:这里是我的项目的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.troii</groupId> 
    <artifactId>testapp</artifactId> 
    <packaging>war</packaging> 
    <version>1.0-SNAPSHOT</version> 

    <dependencies> 
    <dependency> 
     <groupId>org.grails</groupId> 
     <artifactId>grails-crud</artifactId> 
     <version>1.2.0</version> 
    </dependency> 
    <dependency> 
     <groupId>org.grails</groupId> 
     <artifactId>grails-gorm</artifactId> 
     <version>1.2.0</version> 
    </dependency> 

    <!-- Grails defaults to Ehache for the second-level Hibernate cache. --> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-ehcache</artifactId> 
     <version>3.3.1.GA</version> 
    </dependency> 
    <dependency> 
     <groupId>javassist</groupId> 
     <artifactId>javassist</artifactId> 
     <version>3.11.0.GA</version> 
    </dependency> 

    <dependency> 
     <groupId>net.sf.ehcache</groupId> 
     <artifactId>ehcache-core</artifactId> 
     <version>1.7.1</version> 
     <exclusions> 
      <exclusion> 
       <artifactId>jms</artifactId> 
      </exclusion> 
      <exclusion> 
       <artifactId>servlet-api</artifactId> 
      </exclusion> 

      <!-- We have JCL-over-SLF4J instead. --> 
      <exclusion> 
       <artifactId>commons-logging</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 

    <!-- For ease of development and testing, we include the HSQLDB database. --> 
    <dependency> 
     <groupId>hsqldb</groupId> 
     <artifactId>hsqldb</artifactId> 
     <version>1.8.0.10</version> 
    </dependency> 

    <!-- Use Log4J for logging. This artifact also pulls in the Log4J JAR. --> 
    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-log4j12</artifactId> 
     <version>1.5.8</version> 
     <scope>runtime</scope> 
    </dependency> 

    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>jstl</artifactId> 
     <version>1.2</version> 
    </dependency> 
    </dependencies> 

    <repositories> 
    <!-- Required to get hold of JTA --> 
    <repository> 
     <id>maven2-repository.dev.java.net</id> 
     <name>Java.net Repository for Maven</name> 
     <url>http://download.java.net/maven/2/</url> 
     <layout>default</layout> 
    </repository> 
    <repository> 
     <id>Codehaus Snapshots</id> 
     <url>http://snapshots.repository.codehaus.org</url> 
     <snapshots> 
     <enabled>true</enabled> 
     </snapshots> 
     <releases> 
     <enabled>false</enabled> 
     </releases> 
    </repository> 
    </repositories> 

    <pluginRepositories> 
    <pluginRepository> 
     <id>Codehaus Snapshots</id> 
     <url>http://snapshots.repository.codehaus.org</url> 
     <snapshots> 
     <enabled>true</enabled> 
     </snapshots> 
     <releases> 
     <enabled>false</enabled> 
     </releases> 
    </pluginRepository> 
    </pluginRepositories> 

    <build> 
    <pluginManagement /> 
    <plugins> 
     <plugin> 
     <groupId>org.grails</groupId> 
     <artifactId>grails-maven-plugin</artifactId> 
     <version>1.2.0</version> 
     <extensions>true</extensions> 
     <executions> 
      <execution> 
      <goals> 
       <goal>init</goal> 
       <goal>maven-clean</goal> 
       <goal>validate</goal> 
       <goal>config-directories</goal> 
       <goal>maven-compile</goal> 
       <goal>maven-test</goal> 
       <goal>maven-war</goal> 
       <goal>maven-functional-test</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <configuration> 
      <source>1.5</source> 
      <target>1.5</target> 
     </configuration> 
     </plugin> 
    </plugins> 
    </build> 
    <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> 
+0

你可以发布pom.xml文件吗? – rodrigoap 2010-01-15 13:48:53

回答

0

我认为正在发生的事情是你期待的类路径的插件可用编译你的项目的源代码时。插件有自己的类加载器,所以你的类不会看到那里的东西。

相反,将一个项目依赖项定义到一个包含GrailsUser接口的库,并确保该依赖项的范围是compile(默认值)。

+0

是的,我认为这是类似的原因,我不确定这是一个错误还是需要做一些不同的事情。 你知道是否有一个包含acegi插件类的maven工件吗? – 2010-01-15 20:05:15

+0

做这样的工作吗? MVN的Grails:安装,插件-DpluginName = Acegi的 MVN初始化 此处了解详情:http://www.grails.org/Maven+Integration 我没有上述 – 2010-01-15 20:50:51

+0

测试不,这将安装Grails的插件,但品牌没有改变对maven的依赖 – 2010-01-18 12:01:41

相关问题