eclipse-m2e / m2e-core

Eclipse Public License 2.0
113 stars 115 forks source link

Target platform resolution fails with certain Maven artifacts #1622

Open rbioteau opened 11 months ago

rbioteau commented 11 months ago

An error occurs in the latest version of the m2e PDE integration when resolving the following target platform file:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="maven">
    <locations>
        <location includeDependencyDepth="infinite" includeDependencyScopes="compile" missingManifest="generate" type="Maven">
            <dependencies>
                <dependency>
                    <groupId>commons-io</groupId>
                    <artifactId>commons-io</artifactId>
                    <version>2.15.1</version>
                    <type>jar</type>
                </dependency>
            </dependencies>
        </location>
        <location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
            <repository location="https://download.eclipse.org/eclipse/updates/4.30/"/>
            <unit id="org.eclipse.jdt.feature.group" version="3.19.300.v20231201-0110"/>
        </location>
    </locations>
</target>
Problems occurred while resolving the target contents
    An error occurred while collecting items to be installed
        No repository found containing: osgi.bundle,org.apache.commons.commons-io,2.15.1
        session context was:(profile=TARGET_DEFINITION:resource:/my-tp/maven.target, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).

This looks like a regression from previous version. This error does not occur with Tycho 4.0.4.

akurtakov commented 11 months ago

There is similar complain from @rgrunber at https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/2998 which I can't reproduce. @laeubi Any idea what could be going wrong?

laeubi commented 11 months ago

This looks like a regression from previous version.

Can you try to replicate the behavior with:

https://github.com/eclipse-m2e/m2e-core/tree/master/org.eclipse.m2e.pde.target.tests/src/org/eclipse/m2e/pde/target/tests

this are the ones we also share with Tycho to ensure m2e and Tycho work (mostly) the same.

laeubi commented 11 months ago

There is similar complain from @rgrunber at eclipse-jdtls/eclipse.jdt.ls#2998 which I can't reproduce.

Also please note that MIXING maven targets + and site targets where one shadow the other might suffer from this bug recently fixed in PDE:

vhemery commented 11 months ago

I can confirm it as a duplicate of https://github.com/eclipse-pde/eclipse.pde/issues/874 (Romain & I work together on the same project)

The target platform that fails has:

I've opened it with a snaphot IDE from https://download.eclipse.org/eclipse/downloads/drops4/I20231218-1800/ and, after adding the m2e integration, the target platform is correctly resolved. So it should be fixed in 2024-03.

Meantime, as a workaround, commenting the maven plugin out from the target platform also works, since only the P2 plugins are left then.

jcompagner commented 9 months ago

ah so this is a problem because of the target platform through the sites already includes this? because i also now have it for slf4j-api (besides the commons-io described above)

But i guess i can just remove them from the current mvn target because they should come from the other eclipse "normal" p2 sites i guess

By the way this is for me just a target file editor problem, tycho works fine with it and the stupid thing is if i quickly change it through the mvn editor of the target file so commons io back to 2.15.0 and then quickly back to 2.15.1 i can use the target..