eclipse-m2e / m2e-core

Eclipse Public License 2.0
113 stars 115 forks source link

PDE connector fails with pom dependencies #1704

Open segevfiner opened 9 months ago

segevfiner commented 9 months ago

Try the following target defintiion:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="target-platform">
    <locations>
        <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.sdk.ide" version="4.30.0.I20231201-0110"/>
        </location>
        <location includeDependencyDepth="none" includeSource="true" missingManifest="generate" type="Maven">
            <dependencies>
                <dependency>
                    <groupId>de.gesellix</groupId>
                    <artifactId>docker-filesocket</artifactId>
                    <version>2023-09-08T21-55-00</version>
                    <type>jar</type>
                </dependency>
            </dependencies>
        </location>
    </locations>
</target>

You will get the following error:

eclipse.buildId=4.30.0.20231201-1200
java.version=17.0.10
java.vendor=Eclipse Adoptium
BootLoader constants: OS=macosx, ARCH=aarch64, WS=cocoa, NL=en_IL
Framework arguments:  -product org.eclipse.epp.package.rcp.product -product org.eclipse.epp.package.rcp.product -keyring /Users/segevfiner/.eclipse_keyring
Command-line arguments:  -os macosx -ws cocoa -arch aarch64 -product org.eclipse.epp.package.rcp.product -data file:/Users/segevfiner/eclipse-workspace/ -product org.eclipse.epp.package.rcp.product -keyring /Users/segevfiner/.eclipse_keyring

org.eclipse.m2e.pde.target
Error
Thu Feb 29 13:16:40 IST 2024
de.gesellix:docker-filesocket:jar:2023-09-08T21-55-00 is not a bundle and cannot be automatically bundled as such  (Can't collect dependencies!)

org.eclipse.core.runtime.CoreException: Can't collect dependencies!
    at org.eclipse.m2e.pde.target.MavenTargetBundle.lambda$2(MavenTargetBundle.java:164)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:458)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:339)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:278)
    at org.eclipse.m2e.pde.target.MavenTargetBundle.getWrappedArtifact(MavenTargetBundle.java:137)
    at org.eclipse.m2e.pde.target.MavenTargetBundle.<init>(MavenTargetBundle.java:102)
    at org.eclipse.m2e.pde.target.MavenTargetLocation.addBundleForArtifact(MavenTargetLocation.java:356)
    at org.eclipse.m2e.pde.target.MavenTargetLocation.resolveDependency(MavenTargetLocation.java:269)
    at org.eclipse.m2e.pde.target.MavenTargetLocation.resolveArtifacts(MavenTargetLocation.java:170)
    at org.eclipse.m2e.pde.target.MavenTargetLocation.resolveBundles(MavenTargetLocation.java:157)
    at org.eclipse.pde.internal.core.target.AbstractBundleContainer.resolve(AbstractBundleContainer.java:97)
    at org.eclipse.pde.internal.core.target.TargetDefinition.resolve(TargetDefinition.java:385)
    at org.eclipse.pde.internal.ui.editor.targetdefinition.TargetEditor$TargetChangedListener$1.run(TargetEditor.java:651)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.util.zip.ZipException: The JAR/ZIP file (/Users/segevfiner/.m2/repository/com/kohlschutter/junixsocket/junixsocket-core/2.7.0/junixsocket-core-2.7.0.pom) seems corrupted, error: zip END header not found
    at aQute.bnd.osgi.Jar.buildFromZip(Jar.java:311)
    at aQute.bnd.osgi.Jar.<init>(Jar.java:137)
    at aQute.bnd.osgi.Jar.<init>(Jar.java:235)
    at org.eclipse.m2e.pde.target.shared.MavenBundleWrapper.getWrappedNode(MavenBundleWrapper.java:166)
    at org.eclipse.m2e.pde.target.shared.MavenBundleWrapper.getWrappedNode(MavenBundleWrapper.java:178)
    at org.eclipse.m2e.pde.target.shared.MavenBundleWrapper.getWrappedArtifact(MavenBundleWrapper.java:137)
    at org.eclipse.m2e.pde.target.MavenTargetBundle.lambda$2(MavenTargetBundle.java:141)
    ... 13 more
Caused by: java.util.zip.ZipException: zip END header not found
    at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1633)
    at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1641)
    at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1479)
    at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1441)
    at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:718)
    at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:252)
    at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:181)
    at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:195)
    at aQute.bnd.osgi.Jar.buildFromZip(Jar.java:300)
    ... 19 more
segevfiner commented 1 month ago

Any idea for a workaround?

laeubi commented 4 weeks ago

m2e contains a testsuite so a first step should be to add a new testcase to demonstrate the issue and then add support for handling pom dependencies (what could get a bit tricky).

Beside that, its always good to ask people to add OSGi metadata in the first place.

segevfiner commented 4 weeks ago

That's more about fixing this. I'm looking for a way to add the dependency differently without hitting this issue. Expecting non-OSGi fans maintainers of libraries to add OSGi metadata to their jars is unlikely in my experience. OSGi is unfortunately kind of hostile towards the entirety of the existing ecosystem of Java libraries and even JPMS AFAIK...