Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bndtools / Maven with sources JAR #6109

Closed
thahnen opened this issue May 2, 2024 · 5 comments
Closed

Bndtools / Maven with sources JAR #6109

thahnen opened this issue May 2, 2024 · 5 comments

Comments

@thahnen
Copy link

thahnen commented May 2, 2024

TL;DR: I didn't find any concrete information on how to include the sources of JAR archives in the sources.jar that are configured using the -includeresource statement (e.g. -includeresource: lib/guava.jar=guava-*.jar;lib=true does not pack the sources of the guava library into the sources JAR archive).

I found a bit of conflicting information regarding packaging the sources when using Maven. There is THIS thread that seems to not have an answer provided and I found THIS snippet. But if I understood correctly the latter is used to follow the OSGi guidelines and have the sources packed into the normal JAR archive instead of the sources.jar.

So is there any possibility? I'm currently using two different bnd files in the Maven build that are used via the bnd-process goal. The first one uses -includeresource statements like the one mentioned above (but a bit more complicated), and the other one has none.
It is a bit confusing, I was also trying to use -sources: true but it didn't do anything.

So my question is: Is there something possible? Does the -includeresource have an option for that or do I have to invoke something else? Is it possible with Maven or does it require some manual magic perhaps?

@pkriens
Copy link
Member

pkriens commented May 3, 2024

you can include them explicitly?

-includeresource: 
    lib/guava.jar=guava-*.jar;lib=true, \
    OSGI-OPT/src=@guava-sources.jar

@thahnen
Copy link
Author

thahnen commented May 3, 2024

I'm using Maven with the biz.aQute.bnd:bnd-maven-plugin version 6.4.0 and have tried different approaches but with no success.

In my Maven dependencies I have the following ones defined:

<dependencies>
  <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <classifier>sources</classifier>
    </dependency>
</dependencies>

I've tried the following commands:

-includeresource: lib/guava.jar=guava-*.jar;lib:=true,\
  OSGI-OPT/src=@guava-sources.jar
-includeresource: lib/guava.jar=guava-*.jar;lib:=true,\
  OSGI-OPT/src=@guava-*-sources.jar
-includeresource: lib/guava.jar=guava-*.jar;lib:=true,\
  OSGI-OPT/guava-sources.jar=@guava-sources.jar;lib:=true,
-includeresource: lib/guava.jar=guava-*.jar;lib:=true,\
  OSGI-OPT/guava-sources.jar=guava-*-sources.jar;lib:=true,

Am I missing something?

@pkriens
Copy link
Member

pkriens commented May 7, 2024

The syntax you used indicated the guava-*.jar was on the file system. In workspace bnd, you can use ${repo;com.google.guava:guava} instead of the file name to get it from a repository. I am not sure how this works in maven because their repository model is very different, maybe one of the maven users can chime in. @timothyjward ?

@pkriens
Copy link
Member

pkriens commented Jun 7, 2024

Any feedback?

@pkriens
Copy link
Member

pkriens commented Jun 21, 2024

please reopen if you want to take this further.

@pkriens pkriens closed this as completed Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants