Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] [tycho-packaging-plugin] Property value interpolation and forceContextQualifier using 0.23.1

For the records, I found that configuring the tycho-packaging-plugin by expliciting the execution phase resolved the problem.

In my case, build validation failed with the following:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>buildnumber-maven-plugin</artifactId>
  <version>${buildnumber-plugin-version}</version>
  <executions>
    <execution>
      <phase>validate</phase>
      <goals>
        <goal>create</goal>
      </goals>
      <configuration>
       [...]
      </configuration>
    </execution>
  </executions>
</plugin>

[...]

<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>tycho-packaging-plugin</artifactId>
  <version>${tycho-version}</version>
  <configuration>
<forceContextQualifier>v${timestamp}-${buildNumber}</forceContextQualifier>
[...]
  </configuration>
</plugin>

and now succeeds with:

<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>tycho-packaging-plugin</artifactId>
  <version>${tycho-version}</version>
  <executions>
    <execution>
      <phase>validate</phase>
      <goals>
<goal>build-qualifier</goal>
      </goals>
      <configuration>
  <forceContextQualifier>v${timestamp}-${buildNumber}</forceContextQualifier>
  [...]
      </configuration>
    </execution>
  </executions>
</plugin>

This way goal execution order is actually respected and the qualifier is assigned correctly.



On Fri, Jul 24, 2015 at 11:40 AM, Enrico De Fent <enrico.defent@xxxxxxxxxxx> wrote:
Thank you Martin,

I have never used Tycho build timestamp provider and I'll give it a try.

As a general rule (which I apply also to other non-Eclipse projects), I'd prefer to include both the timestamp of the actual build run and the short revision number in the build qualifer or package name. This makes sense to me since I can use the timestamp for referring to things outside source repository and it eases artifacts tracking.

Maybe I'm missing some point about project configuration or something else. However, I've published a minimal test case which displays the problem:

That said, understanding why the execution order is not the expected one seems important to me. Guess that the following bug report states that things like this should not happen at all:

I'm not familiar with Maven plugin development, but I'd dive in a bit to find out more on the issue. Any hint on places to look at in the code is very appreciated :)

-- Enrico


On Wed, Jul 22, 2015 at 10:04 PM, SCHREIBER.Martin <Martin.SCHREIBER@xxxxxxxxxxxxx> wrote:
Hi,

I reproduced your problem and I think that the buildnumber-maven-plugin is executed after the tycho-packaging-plugin (build-qualifier goal) for some reason (both are in the validate phase and so the configuration order should be taken into account).

I think that the build-qualifier goal is executed first, because if you check your debug output for

[DEBUG] === PROJECT BUILD PLAN ================================================

you see, that first the tycho packaging plugin is executing the goal "build-qualifier" and others and at the end it executes the buildnumber-maven-plugin.
So substition is not done because the properties are not yet set.

If I run

mvn -X verify -Dtimestamp=1000 -DbuildNumber=999 the build succeeds, so interpolation is working.

It might have worked with older tycho versions because as you said, with tycho 0.23.0, the build is failing if the qualifiers is not valid.
 
BTW, why do you use the buildnumber-maven-plugin. Not sure about your usecase but can't the tycho build timestamp provider [1] do the same job?

[1] https://wiki.eclipse.org/Tycho/Reproducible_Version_Qualifiers

-martin
 

Von: tycho-user-bounces@xxxxxxxxxxx [tycho-user-bounces@xxxxxxxxxxx]" im Auftrag von "Enrico De Fent [enrico.defent@xxxxxxxxxxx]
Gesendet: Mittwoch, 22. Juli 2015 14:47
An: Tycho user list
Betreff: [tycho-user] [tycho-packaging-plugin] Property value interpolation and forceContextQualifier using 0.23.1

Hello all,

I am experiencing the following issue when building with Tycho 0.23.1.

My project's root POM contains:

<plugin>
 <groupId>org.codehaus.mojo</groupId>
 <artifactId>buildnumber-maven-plugin</artifactId>
 <version>1.3</version>
 <executions>
  <execution>
   <phase>validate</phase>
   <goals>
    <goal>create</goal>
   </goals>
  </execution>
 </executions>
 <configuration>
  <shortRevisionLength>7</shortRevisionLength>
  <doCheck>false</doCheck>
  <doUpdate>false</doUpdate>
  <timestampFormat>{0,date,yyyyMMddHHmm}</timestampFormat>
 </configuration>
</plugin>

[...]

<plugin>
 <groupId>org.eclipse.tycho</groupId>
 <artifactId>tycho-packaging-plugin</artifactId>
<version>0.23.1</version>
 <configuration>
  <forceContextQualifier>v${timestamp}-${buildNumber}</forceContextQualifier>
  <finalName>${project.artifactId}_${unqualifiedVersion}-${buildQualifier}</finalName>
 </configuration>
</plugin>

When the build qualifier gets validated (resolution of bug 464887[1] introduced this step) the value of forceContextQualifier seems to have been not interpolated yet, so an exception is thrown and the build fails, as the output of

$ mvn -X validate

displays below:

[DEBUG] Configuring mojo 'org.eclipse.tycho:tycho-packaging-plugin:0.23.1:build-qualifier' with basic configurator -->
[DEBUG]   (f) baseDir = /home/enrico/projects/XXXX
[DEBUG]   (f) execution = org.eclipse.tycho:tycho-packaging-plugin:0.23.1:build-qualifier {execution: default-build-qualifier}
[DEBUG]   (f) forceContextQualifier = v${timestamp}-${buildNumber}
[DEBUG]   (s) format = yyyyMMddHHmm
[DEBUG]   (f) packaging = eclipse-plugin
[DEBUG]   (f) project = MavenProject: XXXX
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@101a64
[DEBUG] -- end configuration --
[...]
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:0.23.1:build-qualifier (default-build-qualifier) on project XXXX: Invalid build qualifier, it does not match the OSGi qualifier constraint ([0..9]|[a..zA..Z]|'_'|'-') -> [Help 1]

As I can see in the same log, the org.codehaus.mojo:buildnumber-maven-plugin:1.3:create goal is executed before org.eclipse.tycho:tycho-packaging-plugin:0.23.1:build-qualifier, so I would expect that timestamp and buildNumber properties have already been assigned a value when the latter performs its execution. Is this assumption correct?

Builds performed using Tycho 0.22.0 complete without errors, because at some point forceContextQualifier gets its value as expected, as also happens to finalName.

I've noticed that running the build with 0.22.0 actually displays the following:

[INFO] The project's OSGi version is 0.9.17.v${timestamp}-${buildNumber}

Why forceContextQualifier value does not benefit from interpolation in the validation phase?

Is there a way by which I could get the qualifier set in the POM using values of other properties?


Thanks for your attention,
regards



--
Enrico

_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user



--
Enrico De Fent
VDS Rail



--
Enrico De Fent
VDS Rail

Back to the top