[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Project no longer builds in Eclipse after upgrading to m2e 1.4

Hi Igor,

Thanks for the link your working version.

The _snapshot instruction looks interesting, but I think(?) there is a
problem with that approach: the release version x.y.z will be
considered lower than the snapshots x.y.z.timestamp. This means that
Eclipse may not upgrade all the bundles to a release version when a
user tries to upgrade a snapshot version to a release version.

I think I will go with the following for now:

        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <extensions>true</extensions>
          <configuration>
            <instructions>
              <Bundle-Version>

$${replace;${project.version};(.*)-SNAPSHOT;$1}.${build.qualifier}
              </Bundle-Version>
            </instructions>
          </configuration>
        </plugin>

... where ${build.qualifier} is ${maven.build.timestamp} or
"qualifier" under m2e as you suggest.

This should ensure that the release version gets a qualifier that's
higher than any snapshot version.

I'm unable to reliably reproduce the problem I have with the
tycho-packaging-plugin in a standalone project. Sometimes the project
where I first noticed the problem will build in m2e, so I'm left doing
the m2eclipse dance trying investigate it. My *guess* is that there is
some race condition on the workspace, related to the duration of the
build and when the bundle plugin writes the MANIFEST.MF. I don't yet
see what is different between my actual project and a standalone test.

Thanks,
Martin



On 8 August 2013 04:59, Igor Fedorenko <igor@xxxxxxxxxxxxxx> wrote:
> Can you provide a small standalone example project that builds on
> command line but fails inside m2e workspace?
>
> Generally, I do not believe it is possible to use tycho-packaging-plugin
> build-qualifier goal for non-tycho projects. I thought I filed a Tycho
> enhancement request about this, but can't find it any more, maybe it was
> closed for the lack of interest.
>
> To manage OSGi version qualifier of maven-bundle-plugin (m-b-p for
> short) projects I usually set <_snapshot> bnd instruction to
> "${maven.build.timestamp}" for regular command line builds and
> ".qualifier" when working on the projects inside m2e. The latter is
> needed because m2e doesn't/can't maintain ${maven.build.timestamp}
> property. You can see complete working configuration example in [1].
>
> [1]
> http://git.eclipse.org/c/m2e/m2e-core.git/tree/m2e-maven-runtime/pom.xml?id=releases/1.4/1.4.0.20130601-0317
>
> --
> Regards,
> Igor
>
>
> On 2013-08-08 3:32 AM, Martin Ellis wrote:
>>
>> Hi,
>>
>> I'm trying to understand why my project no longer builds in Eclipse
>> after upgrading to m2e 1.4.
>>
>> The project consists of several OSGi bundles, built using the Felix
>> maven-bundle-plugin, all in a reactor.
>>
>> They are later picked up and used by a Tycho build for use in an
>> Eclipse plugin. In order to ensure that these bundles are updated when
>> upgrading the Eclipse plugin, I have added a build qualifier to the
>> bundle-plugin builds:
>>
>>          <plugin>
>>            <groupId>org.eclipse.tycho</groupId>
>>            <artifactId>tycho-packaging-plugin</artifactId>
>>            <version>${tycho.version}</version>
>>            <executions>
>>              <execution>
>>                <id>timestamp</id>
>>                <phase>validate</phase>
>>                <goals>
>>                  <goal>build-qualifier</goal>
>>                </goals>
>>              </execution>
>>            </executions>
>>          </plugin>
>>
>> Then used the ${unqualifiedVersion} and ${buildQualifier} set by the
>> build-qualifier goal in the Bundle-Version as follows:
>>
>>          <plugin>
>>            <groupId>org.apache.felix</groupId>
>>            <artifactId>maven-bundle-plugin</artifactId>
>>            <extensions>true</extensions>
>>            <configuration>
>>              <manifestLocation>META-INF</manifestLocation>
>>              <instructions>
>>
>> <Bundle-Version>${unqualifiedVersion}.0.${buildQualifier}</Bundle-Version>
>>              </instructions>
>>            </configuration>
>>          </plugin>
>>
>> Previously, I had used a lifecycle mapping to ensure that the
>> build-qualifier goal was run by m2e:
>>
>>          <plugin>
>>            <groupId>org.eclipse.m2e</groupId>
>>            <artifactId>lifecycle-mapping</artifactId>
>>            <version>1.0.0</version>
>>            <configuration>
>>              <lifecycleMappingMetadata>
>>                <pluginExecutions>
>>                  <pluginExecution>
>>                    <pluginExecutionFilter>
>>                      <groupId>org.eclipse.tycho</groupId>
>>                      <artifactId>tycho-packaging-plugin</artifactId>
>>                      <versionRange>[0.13.0,)</versionRange>
>>                      <goals>
>>                        <goal>build-qualifier</goal>
>>                      </goals>
>>                    </pluginExecutionFilter>
>>                    <action>
>>                      <execute />
>>                    </action>
>>                  </pluginExecution>
>>                </pluginExecutions>
>>              </lifecycleMappingMetadata>
>>            </configuration>
>>          </plugin>
>>
>> However, after updating to m2e, I am seeing the following error in my
>> Eclipse log:
>>
>>    Invalid value for Bundle-Version,
>> ${unqualifiedVersion}.0.${buildQualifier} does not match
>> [0-9]+(\.[0-9]+(\.[0-9]+(\.[0-9A-Za-z_-]+)?)?)?
>>
>> I don't understand why these properties are no longer being interpolated.
>>
>> Is there a better way to get a build qualifier timestamp that's
>> consistent across projects in a reactor, and that also works in m2e?
>>
>> Please let me know if a test project would help.
>>
>> Thanks
>> Martin
>> _______________________________________________
>> m2e-users mailing list
>> m2e-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/m2e-users
>>
> _______________________________________________
> m2e-users mailing list
> m2e-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/m2e-users