2013-09-18 2 views
1

Учитывая профиль, развития в соответствии с Maven pom.xmlMaven работает в профиле казни только после сборки казни

<profiles> 
    <profile> 
     <id>development</id> 

     <build> 
      <plugins> 
       <plugin> 
        <groupId>org.liquibase</groupId> 
        <artifactId>liquibase-maven-plugin</artifactId> 
        <version>3.0.4</version> 
        <executions> 
         <execution> 
          <id>01-liquibase.dropAll</id> 
          <phase>process-resources</phase> 
          <configuration> 
           [...skip...] 
          </configuration> 
          <goals> 
           <goal>dropAll</goal> 
          </goals> 
         </execution> 
        </executions> 
       </plugin> 

      </plugins> 
     </build> 
    </profile> 
</profiles> 

и основной раздел pom.xml:

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.openjpa</groupId> 
      <artifactId>openjpa-maven-plugin</artifactId> 
      <version>2.2.2</version> 

      <configuration> 
       <includes>package/pm/entity/**/*.class</includes> 
       <addDefaultConstructor>true</addDefaultConstructor> 
       <enforcePropertyRestrictions>true</enforcePropertyRestrictions> 
       <persistenceXmlFile>${project.parent.basedir}/forms-webapp/src/main/resources/META-INF/persistence.xml</persistenceXmlFile> 
      </configuration> 
      <executions> 
       <execution> 
        <id>02-enhancer</id> 
        <phase>process-classes</phase> 
        <goals> 
         <goal>enhance</goal> 
        </goals> 
       </execution> 
      </executions> 
      <dependencies> 
       <dependency> 
        <groupId>org.apache.openjpa</groupId> 
        <artifactId>openjpa</artifactId> 
        <version>2.2.2</version> 
       </dependency> 
      </dependencies> 
     </plugin> 

     <plugin> 
      <groupId>org.liquibase</groupId> 
      <artifactId>liquibase-maven-plugin</artifactId> 
      <version>3.0.4</version> 
      <executions> 

       <execution> 
        <id>03-liquibase.update</id> 
        <phase>process-resources</phase> 
        <configuration> 
         [...skipped...] 
        </configuration> 
        <goals> 
         <goal>update</goal> 
        </goals> 
       </execution> 

       <!-- for tests --> 
       <execution> 
        <id>04-liquibase-test.dropAll</id> 
        <phase>process-test-resources</phase> 
        <configuration> 
         [...skipped...] 
        </configuration> 
        <goals> 
         <goal>dropAll</goal> 
        </goals> 
       </execution> 

       <execution> 
        <id>05-liquibase-test.update</id> 
        <phase>process-test-resources</phase> 
        <configuration> 
         [...skipped...] 
        </configuration> 
        <goals> 
         <goal>update</goal> 
        </goals> 
       </execution> 

      </executions> 
     </plugin> 

    </plugins> 
</build> 

Я ожидаю, что казни будет работать в в следующем порядке:

....

01-liquibase.dropAll

03-liquibase.update

....

Но в журнале сборки я вижу:

[INFO] --- liquibase-maven-plugin:3.0.4:update (03-liquibase.update) @ forms-entity --- 
[INFO] ------------------------------------------------------------------------ 
[INFO] Parsing Liquibase Properties File 
[INFO] File: src/main/resources/liquibase.properties 
[INFO] 'classpath' in properties file is not being used by this task. 
[INFO] ------------------------------------------------------------------------ 
[INFO] Executing on Database: jdbc:postgresql://localhost/pman_trunk 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] 
[INFO] --- liquibase-maven-plugin:3.0.4:dropAll (01-liquibase.dropAll) @ forms-entity --- 
[INFO] ------------------------------------------------------------------------ 
[INFO] Parsing Liquibase Properties File 
[INFO] File: src/main/resources/liquibase.properties 
[INFO] 'classpath' in properties file is not being used by this task. 
[INFO] ------------------------------------------------------------------------ 
[INFO] Executing on Database: jdbc:postgresql://localhost/pman_trunk 
[INFO] ------------------------------------------------------------------------ 

Есть ли способ исправить это неправильный порядок выполнения?

ответ

1

Исполнения для id 01-liquibase.dropAll и 03-liquibase.update выполняются на той же фазе.

Вы всегда можете переместить исполнение с идентификатором 01-liquibase.dropAll на более ранней стадии, такие как generate-resources

     <id>01-liquibase.dropAll</id> 
         <phase>process-resources</phase> 

См Lifecycle раздел По умолчанию в Maven Lifecycle Reference.

Смежные вопросы