Skip to content

org.eclipse.angus.mail bundle fails to resolve under OSGi due to mandatory 'sun.security.util' package  #15

@HannesWell

Description

@HannesWell

Describe the bug
When using the Maven module org.eclipse.angus:angus-mail:1.0.0 as an OSGi bundle in an OSGi-application like Eclipse respectively Equinox, the bundle fails to resolve due to the unsatisfied constraint Import-Package sun.security.util.

Comparing with com.sun.mail:jakarta.mail:2.0.1 reveals that the Package-Import Import-Package sun.security.util was optional there but is not optional for org.eclipse.angus:angus-mail.

First I suspected a missing BND instruction in your configuration of the maven-bundle-plugin that generates the MANIFEST.MF, but while preparing this issue I noticed that a corresponding instruction exist (even before the 1.0.0 release):

sun.security.util;resolution:=optional,

Nevertheless in the META-INF/MANIFEST.MF from the jar available from Maven-Central the following Import-Package header specified that, declares the package sun.security.util as mandatory:

Import-Package: com.sun.mail.auth;version="[1.0,2)",com.sun.mail.iap;ver
 sion="[1.0,2)",com.sun.mail.imap;version="[1.0,2)",com.sun.mail.imap.pr
 otocol;version="[1.0,2)",com.sun.mail.util;version="[1.0,2)",jakarta.ac
 tivation;version="[2.1,3)",jakarta.mail;version="[2.1,3)",jakarta.mail.
 event;version="[2.1,3)",jakarta.mail.internet;version="[2.1,3)",jakarta
 .mail.search;version="[2.1,3)",jakarta.mail.util;version="[2.1,3)",java
 x.crypto,javax.crypto.spec,javax.net,javax.net.ssl,javax.security.auth.
 callback,javax.security.auth.x500,javax.security.sasl,javax.xml.transfo
 rm,javax.xml.transform.stream,sun.security.util

I cannot tell why the maven-bundle-plugin configuration is ignored, but it looks like there is a problem in the build process.

To Reproduce
In the Eclipse IDE with (PDE and m2e installed), create a project that contains a target-platform like the following and set it as active target-platform.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="target">
		<location includeDependencyDepth="infinite" includeDependencyScopes="compile,provided,runtime,import" includeSource="true" label="Mail dependencies" missingManifest="generate" type="Maven">
			<dependencies>
				<dependency>
					<groupId>org.eclipse.angus</groupId>
					<artifactId>angus-mail</artifactId>
					<version>1.0.0</version>
					<type>jar</type>
				</dependency>
			</dependencies>
		</location>
	</locations>
</target>

Open the Target-Platform State view and select "Show only unresolved plug-ins" as displayed in the screenshot below.
Create a Eclipse Application launch that includes the Plug-in/Bundle org.eclipse.angus.mail to get the failed launch validation from the screenshot below.

Screenshots
image

image

Desktop (please complete the following information):

  • OS: Windows-10, Linux Debian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions