ppkarwasz commented on code in PR #114:
URL:
https://github.com/apache/commons-secure-xml/pull/114#discussion_r4223759847
##########
pom.xml:
##########
@@ -391,6 +413,107 @@ limitations under the License.
</execution>
</executions>
</plugin>
+ <!--
+ Writes a fragment manifest into the test output directory,
+ so OsgiIT can install it as an exploded bundle attached to the library.
+ The imports are optional:
+ the test harness (JUnit, Mockito, JAXB) is boot-delegated to the class
path by OsgiIT.
+ -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>test-bundle-manifest</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>manifest</goal>
+ </goals>
+ <configuration>
+
<outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
+
<manifestLocation>${project.build.testOutputDirectory}/META-INF</manifestLocation>
+ <instructions>
+
<Bundle-SymbolicName>${commons.osgi.symbolicName}.tests</Bundle-SymbolicName>
+ <Fragment-Host>${commons.osgi.symbolicName}</Fragment-Host>
+ <Export-Package>!*</Export-Package>
+ <Private-Package>org.apache.commons.xml.*</Private-Package>
+ <Import-Package>*;resolution:=optional</Import-Package>
+ <!-- The java11 test sources would otherwise raise the osgi.ee
requirement to that of the build JDK. -->
+ <_noee>true</_noee>
+ <!-- The host is the bundle under test, not a dependency. -->
+ <_fixupmessages>"Host *cannot be found on the
classpath";is:=ignore</_fixupmessages>
Review Comment:
The `*` is a wildcard: bnd matches `-fixupmessages` patterns as globs.
Without the instruction, the build prints:
```
[WARNING] Manifest org.apache.commons:commons-secure-xml:jar:1.1.1-SNAPSHOT
: Host org.apache.commons.xml.secure= for this fragment/require bundle cannot
be found on the classpath
```
so the `*` stands for `org.apache.commons.xml.secure= for this
fragment/require bundle `.
Why it appears: a fragment shares its host's class loader, so bnd looks the
host bundle up on the build class path and removes the host's packages from the
fragment's `Import-Package`
([`Analyzer.getHostPackages()`](https://github.com/bndtools/bnd/blob/6.3.1/biz.aQute.bndlib/src/aQute/bnd/osgi/Analyzer.java#L483-L543)).
Here the host is this module's own jar: it is not a dependency, and it is not
built yet in `process-test-classes`, so the lookup fails.
The warning is harmless: the test classes are in the host's packages and are
included through `Private-Package`, so the generated fragment manifest imports
no `org.apache.commons.xml.*` package anyway.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]