2013-09-01 37 views
2

我正在使用maven sql插件。我正在使用该插件在执行集成测试之前设置我的测试数据库。这是我的项目pom中的插件配置。当我执行mvn clean install时,我期望执行插件目标。但他们没有被执行。任何帮助将不胜感激。我正在面向aspectj插件的类似问题(下面提供的配置)。无法将插件目标绑定到maven生命周期阶段

我的SQL插件配置:

<!-- Maven SQL Plugin for setting up test schema for integration tests --> 
<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>sql-maven-plugin</artifactId> 
    <version>1.5</version> 
    <dependencies> <!-- specify the dependent JDBC driver here --> 
     <dependency> 
      <groupId>${jdbc.groupId}</groupId> 
      <artifactId>${jdbc.artifactId}</artifactId> 
      <version>${jdbc.version}</version> 
     </dependency> 
    </dependencies> 
    <!-- common configuration shared by all executions --> 
    <configuration> 
     <driver>org.hsqldb.jdbcDriver</driver> 
     <url>jdbc:hsqldb:sample</url> 
     <username>sa</username> 
     <password></password> 
    </configuration> 

    <executions> 
     <execution> 
      <id>create_db_schema</id> 
      <phase>process-test-resources</phase> 
      <goals> 
       <goal>execute</goal> 
      </goals> 
      <!-- specific configuration for this execution --> 
      <configuration> 
       <srcFiles> 
        <srcFile>src/test/resources/test-schema.sql</srcFile> 
       </srcFiles> 
      </configuration> 
     </execution> 
     <execution> 
      <id>shutdown_db_instance</id> 
      <phase>process-test-resources</phase> 
      <goals> 
       <goal>execute</goal> 
      </goals> 
      <configuration> 
       <sqlCommand>SHUTDOWN IMMEDIATELY</sqlCommand> 
      </configuration> 
     </execution> 
    </executions> 
</plugin> 

我AspectJ的插件配置:

<!-- AspectJ Compile-time waving for spring cross-store. --> 
<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>aspectj-maven-plugin</artifactId> 
    <version>1.4</version> 
    <executions> 
     <execution> 
      <goals> 
       <goal>compile</goal> 
       <goal>test-compile</goal> 
      </goals> 
     </execution> 
    </executions> 
    <configuration> 
     <outxml>true</outxml> 
     <showWeaveInfo>true</showWeaveInfo> 
     <aspectLibraries> 
      <aspectLibrary> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-aspects</artifactId> 
      </aspectLibrary> 
      <aspectLibrary> 
       <groupId>org.springframework.data</groupId> 
       <artifactId>spring-data-mongodb-cross-store</artifactId> 
      </aspectLibrary> 
     </aspectLibraries> 
     <source>1.6</source> 
     <target>1.6</target> 
    </configuration> 
</plugin> 

回答

4

确保这些插件并不里面project/build/pluginManagement/plugins定义,但在project/build/plugins。 只有后者才会执行,那么这些插件将会与pluginManagement一起检查最终的配置。

+1

谢谢你做到了。你能解释两者之间有什么不同吗? –

+0

你需要在你的搜索技巧上工作;)http://stackoverflow.com/questions/10483180/maven-what-is-pluginmanagement –

相关问题