2016-04-01 13 views
1

Maven’e yeni geliyorum ve kaynağın zaten kontrol edilip edilmediğine bağlı olarak SCM eklenti hedefini checkout ile arası güncellemeyi otomatik olarak değiştirmeye çalıştığım bir sorun yaşıyorum.Maven SCM eklentisi, varolan dizine göre hedefleri otomatik olarak değiştirmek için nasıl tetiklenir?

kimse bana bu çalışma almak için bir kod örneği gösterebilir misiniz? Bu eklenti yapılandırması:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-scm-plugin</artifactId> 
    <version>1.9.4</version> 
     <executions> 
      <execution> 
       <phase>generate-sources</phase> 
       <goals> 
        <goal>checkout</goal> 
       </goals> 
       <configuration> 
        <connectionType>developerConnection</connectionType> 
        <scmVersion>master</scmVersion> 
        <scmVersionType>branch</scmVersionType> 
        <checkoutDirectory>${project.basedir}/src</checkoutDirectory> 
        <workingDirectory>${project.basedir}/src</workingDirectory> 
       </configuration> 
      </execution> 
     </executions> 
</plugin> 

cevap

0

değişim goal:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-scm-plugin</artifactId> 
    <version>1.9.4</version> 
     <executions> 
      <execution> 
       <phase>generate-sources</phase> 
       <goals> 
        <goal>update</goal> 
       </goals> 
       <configuration> 
        <connectionType>developerConnection</connectionType> 
        <scmVersion>master</scmVersion> 
        <scmVersionType>branch</scmVersionType> 
        <checkoutDirectory>${project.basedir}/src</checkoutDirectory> 
        <workingDirectory>${project.basedir}/src</workingDirectory> 
       </configuration> 
      </execution> 
     </executions> 
</plugin> 

Referans
https://maven.apache.org/scm/maven-scm-plugin/
https://maven.apache.org/scm/maven-scm-plugin/update-mojo.html

+0

Teşekkür mı, Güncelleme başarısız olur. Bu, ödeme işleminin tamamlanıp tamamlanmadığına göre otomatik olarak ödeme ve güncelleme arasında nasıl geçiş yapar? Soruyu açıklığa kavuşturdum. – garyM

+0

sizin için belki yararlı Bu linki: https://maven.apache.org/scm/maven-scm-plugin/examples/bootstrapping-with-pom.html –

+0

sayesinde otomatik olarak geçiş yapmak istedik. set özelliği varsayılan değer 'skipCheckoutIfExists = FALSE https://maven.apache.org/scm/maven-scm-plugin/checkout-mojo.html# gibi: Ben bu çözüm denemek için bir şans verin – garyM

0

SCM eklentisi hedefini değiştirmek için DJO như esinlenerek Vı (yukarıda).

Yaklaşım

  1. için varsayılan değer yani güncelleme ayarlanmış bir özellik olarak adlandırılan scm.goal amaç Yeri oldu.
  2. 'kasada' için 'güncelleme' dan scm.goal özellik değerini değiştirmek için bir profil (önyükleme) kullanın.
  3. .gitignore dosyası eksik dayalı önyükleme profili etkinleştirin.
  4. Yeri SCM eklentisi gol elemanda mülkiyet scm.goal.

Kodu: Proje ödeme kullanılarak bootstrapped değilse

<properties> 
     <scm.dest.path>${project.basedir}/src</scm.dest.path> 
     <scm.goal>update</scm.goal> 
    </properties> 

    <profiles> 
     <profile> 
      <id>bootstrap</id> 
      <activation> 
       <file> 
        <missing>./src/.gitignore</missing> 
       </file> 
      </activation> 
      <properties> 
       <scm.goal>checkout</scm.goal> 
      </properties> 
     </profile> 
    </profiles> 
    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-scm-plugin</artifactId> 
       <version>1.9.4</version> 
       <executions> 
        <execution> 
         <phase>generate-sources</phase> 
         <goals> 
          <goal>${scm.goal}</goal> 
         </goals> 
         <configuration> 
          <connectionType>developerConnection</connectionType> 
          <scmVersion>master</scmVersion> 
          <scmVersionType>branch</scmVersionType> 
          <checkoutDirectory>${scm.dest.path}</checkoutDirectory> 
          <workingDirectory>${scm.dest.path}</workingDirectory> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
... 
İlgili konular