2012-03-28 6 views
3

내가 함께 빈 프로젝트를 생성 compile`하지 않습니다 생성 :GMaven 프로젝트는`MVN은

mvn archetype:generate -DarchetypeGroupId=org.codehaus.gmaven.archetypes -DarchetypeArtifactId=gmaven-archetype-basic -DarchetypeVersion=1.4

그것은 무리 메시지 "package groovy.lang does not exist"mvn compile에 실패합니다.

(난 그냥 집어 archetypeVersion의 마지막 GMaven 릴리스 버전)

내 메이븐/GMaven/그루비 문제점은 무엇입니까?

<?xml version="1.0" encoding="UTF-8"?> 
<!-- 
    Generated from archetype; please customize. 
--> 

<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>a</groupId> 
    <artifactId>asd</artifactId> 
    <name>asd project</name> 
    <version>1.0-SNAPSHOT</version> 

    <dependencies> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>3.8.2</version> 
      <scope>test</scope> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.codehaus.gmaven</groupId> 
       <artifactId>gmaven-plugin</artifactId> 
       <version>1.4</version> 
       <configuration> 
        <providerSelection>1.8</providerSelection> 
       </configuration> 
       <executions> 
        <execution> 
         <goals> 
          <goal>generateStubs</goal> 
          <goal>compile</goal> 
          <goal>generateTestStubs</goal> 
          <goal>testCompile</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 

</project> 
+0

pom을 표시 할 수 있습니까? – khmarbaise

+0

pom을 추가했습니다. –

답변

2

나는 Groovy in Maven에 대한 완전한 예를 만들었습니다. 그것을 한번보세요.

+0

샘플을 보내 주셔서 감사합니다. 저의 경우 이미 그 때까지 작동하는 구성을 가지고있었습니다. 나는 대체 답변으로 게시 할 것입니다. –

1

제 자신 만의 방식으로 작동합니다. 버전 문제였습니다. @khmarbaise의 버전에는 버전 유연성과 같은 좋은 아이디어가 있습니다.

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <groovy.version>2.0.0-beta-2</groovy.version> 
</properties> 

<dependencies> 

    <!-- ... something ... --> 

    <dependency> 
     <groupId>org.codehaus.groovy</groupId> 
     <artifactId>groovy</artifactId> 
     <version>${groovy.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.codehaus.gmaven.runtime</groupId> 
     <artifactId>gmaven-runtime-1.7</artifactId> 
     <version>1.3</version> 
     <exclusions> 
      <exclusion> 
       <groupId>org.codehaus.groovy</groupId> 
       <artifactId>groovy-all</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
</dependencies> 

<!-- ... something ... --> 

<build> 
    <!-- make Java compile from groovy folders as well... --> 
    <sourceDirectory>src/main/groovy</sourceDirectory> 
    <testSourceDirectory>src/test/groovy</testSourceDirectory> 

<plugins> 
    <plugin> 
     <groupId>org.codehaus.gmaven</groupId> 
     <artifactId>gmaven-plugin</artifactId> 
     <version>1.3</version> 
     <dependencies> 
      <dependency> 
       <groupId>org.codehaus.groovy</groupId> 
       <artifactId>groovy</artifactId> 
       <version>${groovy.version}</version> 
      </dependency> 
      <dependency> 
       <groupId>org.codehaus.gmaven.runtime</groupId> 
       <artifactId>gmaven-runtime-1.7</artifactId> 
       <version>1.3</version> 
       <exclusions> 
        <exclusion> 
         <groupId>org.codehaus.groovy</groupId> 
         <artifactId>groovy</artifactId> 
        </exclusion> 
       </exclusions> 
      </dependency> 
     </dependencies> 
     <executions> 
      <execution> 
       <configuration> 
        <providerSelection>1.7</providerSelection> 
       </configuration> 
       <goals> 
        <goal>generateStubs</goal> 
        <goal>compile</goal> 
        <goal>generateTestStubs</goal> 
        <goal>testCompile</goal> 
       </goals> 
      </execution> 
     </executions> 
    </plugin> 
    <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>2.3.2</version> 
     <configuration> 
      <source>1.5</source> 
      <target>1.5</target> 
     </configuration> 
    </plugin> 
</plugins> 
+1

Groovy 2의 사용자에게는 downvote가있는 것처럼 보였습니다. –