2013-03-19 72 views
1

我有以下spock的maven配置和spring。Spring和Spock的Maven配置在STS

<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>org.test</groupId> 
<artifactId>spock</artifactId> 
<packaging>jar</packaging> 
<version>1.0-SNAPSHOT</version> 
<name>spock</name> 
<url>http://maven.apache.org</url> 

<properties> 
    <!-- <maven.test.search.classdir>true</maven.test.search.classdir> --> 
    <targetJdk>1.6</targetJdk> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <spring.version>3.2.1.RELEASE</spring.version> 
</properties> 

<dependencies> 
    <!-- testing with spock --> 
    <dependency> 
     <groupId>org.spockframework</groupId> 
     <artifactId>spock-core</artifactId> 
     <version>0.6-groovy-1.8</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.codehaus.groovy</groupId> 
     <artifactId>groovy</artifactId> 
     <version>2.1.1</version> 
     <scope>test</scope> 
    </dependency> 

    <!-- spring --> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-core</artifactId> 
     <version>${spring.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-context</artifactId> 
     <version>${spring.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-beans</artifactId> 
     <version>${spring.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-test</artifactId> 
     <version>${spring.version}</version> 
     <scope>test</scope> 
    </dependency> 

    <dependency> 
     <groupId>javax.inject</groupId> 
     <artifactId>javax.inject</artifactId> 
     <version>1</version> 
    </dependency> 


</dependencies> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.codehaus.gmaven</groupId> 
      <artifactId>gmaven-plugin</artifactId> 
      <version>1.3</version> 
      <configuration> 
       <providerSelection>1.7</providerSelection> 
      </configuration> 
      <executions> 
       <execution> 
        <goals> 
         <goal>testCompile</goal> 
        </goals> 
       </execution> 
      </executions> 
      <dependencies> 
       <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> 
       <dependency> 
        <groupId>org.codehaus.groovy</groupId> 
        <artifactId>groovy-all</artifactId> 
        <version>1.8.6</version> 
       </dependency> 
      </dependencies> 
     </plugin> 

    </plugins> 
</build> 

它工作在終端,但在STS/Eclipse的精細,IDE顯示我下面的錯誤:

Plugin execution not covered by lifecycle configuration: org.codehaus.gmaven:gmaven-plugin:1.3:testCompile (execution: default, phase: test-compile) 

我不知道什麼補充。

+1

查看答案http://stackoverflow.com/questions/9142533/plugin-execution-not-covered-by-lifecycle-configuration-jbossas-7-ear-archetype.It可能可以解決您的問題。 – Adi 2013-03-20 09:14:01

+0

忽略插件的quickfix做到了,謝謝! – myborobudur 2013-03-21 14:20:57

回答

0

你可以試試,

<plugin> 
     <groupId>org.codehaus.gmavenplus</groupId> 
     <artifactId>gmavenplus-plugin</artifactId> 
     <version>1.5</version> 
     <executions> 
      <execution> 
       <goals> 
        <!-- Adds Groovy tests source to project's test source --> 
        <goal>addTestSources</goal> 
        <!-- Compiles spock tests --> 
        <goal>testCompile</goal> 
       </goals> 
      </execution>`` 
     </executions> 
    </plugin> 

而且也切換到的IntelliJ。這是一個非常好的IDE。

相關問題