2016-11-01 11 views
5

. (Bu Veli çünkü bunun içindeki $ {project.parent.version} Mülkiyet vardır ben yönetebil olmayan bazı Projesi) benim Esas POM Bir Çocuk özelliğini yeniden hesaplanması ve bu dendiğinde

Sorun sonra ne oluşturulan Mülkün değeri şimdi Ana POM'imin sürümüdür. End'indeki


<project> 
<!-- Super Pom --> 
<groupId>groupId</groupId> 
    <artifactId>artifactId</artifactId> 
    <version>1.2.3</version> 
</project> 

<project> 
<!-- MainPom --> 
    <groupId>othergroupId</groupId> 
    <artifactId>otherartifactId</artifactId> 
    <version>1.0.0</version> 
    <parent> 
     <groupId>groupId</groupId> 
     <artifactId>artifactId</artifactId> 
     <version>1.2.3</version> 
    </parent> 
    <properties> 
    <dependency.version>${project.parent.version}</dependency.version> 
    </properties> 
    <dependencyManagement> 
     <dependencies> 
      <dependency> 
       <groupId>dependencyGroupId<groupId> 
       <artifactId>dependency</artifactId> 
       <version>${dependency.version}</version> 
      </dependency> 
     </dependencies> 
    </dependencyManagement> 
</project> 
<project> 
<!-- ChildPom --> 
    <groupId>childGroupId</groupId> 
    <artifactId>childArtifactId</artifactId> 
    <version>1.0.0</version> 
    <parent> 
     <groupId>othergroupId</groupId> 
     <artifactId>otherartifactId</artifactId> 
     <version>1.0.0</version> 
    </parent> 
     <dependencies> 
      <dependency> 
       <groupId>dependencyGroupId<groupId> 
       <artifactId>dependency</artifactId> 
      </dependency> 
     </dependencies> 
</project> 

--SuperParent (not in my Administration) | Version = 1.2.3 

----MainPom | Version = 1.0.0 | Property <test>${project.parent.version}</test> -> 1.2.3 

------Child Pom | Version 1.0.0 | Property ${test} is now 1.0.0 

Çocuk Pom 1.0.0 yerine 1.2.3 Mülkiyet $ {dependency.version} şeklindedir. bu Maven aranan bir davranış mı? Ve ben ne yapmalıyım? değiştirilemez

şeyler:

  • SuperPom
  • Ana Pom Versiyon

cevap

4

Maven'in ilk işlem kalıtım etkili pom ardından süreç değişkenleri genişleme inşa etmek.

diğerleri deyişle, ebeveyn ve çocuk pom içerikleri her çocuk pom için tek bir birleştirilmiş dosya olarak işlenir. Çocuğunuz pom $ {project.parent.version} işleniyor Yani 1.0.0 değil 1.2.3 olduğunu.

Bir pom "büyükbaba" başvurmak için bir yol bulamadık, yüzden tek çözüm parent.version ve properties.dependency.version hem statik numara olarak versiyonunu koymak gibi görünüyor. SuperPom sürümü değiştiğinde

+0

Yani, mümkün olan tek yolu değişti 2 Fields (Ana ve Mülkiyet sürüm) için mi? – Serverfrog

+0

Temel olarak, evet. Ve parent.version alanındaki bir değişkeni kullanamazsınız çünkü maven değişkenleri işlemeden önce üst öğeyi yüklemeye çalışırsınız. – Vinicius

+0

Bu kesinlikle iç karartıcı. – Matthias

İlgili konular