Open holgerknoche opened 2 years ago
Hi @holgerknoche, how do you solve this problem ?
Hi @jsventura, we actually just avoid building the projects with "mvn compile". Since the goals we really need are "package" and "install" and those work fine, this issue is not really a problem for us. Maybe it would be enough to move the goal from the "compile" phase to the "package" phase, but I have not tried this yet.
I've been able to reproduce this, and I'm pretty sure it's to do with our default lifecycle bindings when you're using the cics-bundle packaging type. I'll work on a fix for this to build the bundle as late as possible in reactor builds, probably changing the binding for all plugins to the package
phase but that will require a new plugin major version. Also not been able to quite get that working yet.
In the mean time I was able to work around this by changing the phase bound to the bundle plugin's build
goal:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>stewf</groupId>
<artifactId>parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>cics</artifactId>
<packaging>cics-bundle</packaging>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>osgi</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.ibm.cics</groupId>
<artifactId>cics-bundle-maven-plugin</artifactId>
<version>1.0.3</version>
<extensions>true</extensions>
<configuration>
<jvmserver>asdf</jvmserver>
</configuration>
<executions>
<execution>
<id>default-build</id> <!-- You must set this execution ID for this to work -->
<phase>package</phase> <!-- rebind the default execution to the package phase -->
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Note that the latest phase you'll be able to run this in at the moment is package
without also changing the lifecycle phase of the cics bundle package plugin too. I can explain further if that's useful, but hopefully that's not an issue for you.
I'll put together something to address the default lifecycle phase in a future release of the plugin, hopefully you can make do with the workaround for now.
Consider the following multi-module Maven project. One module is an OSGi bundle built with the maven-bundle-plugin. The other module is a CICS bundle that includes the OSGi bundle. Building the entire project with "mvn compile" fails with the error message "Error reading Bundle-SymbolicName from OSGi manifest file". Building it with "mvn package" or "mvn install" works fine. The maven-bundle-plugin creates the bundle manifest after compilation (in the process-classes phase), as it inspects the class files to determine which packages to import and export. Maybe the check for the symbolic name could be moved so that it is only executed when an actual packaging occurs.