Skip to content

Commit

Permalink
Use the main project to let bnd compute the output file
Browse files Browse the repository at this point in the history
Currently we compute the name of the subjar manually, but this can be
overridden by the user so it is better to let bnd calculate the file
itself. Additional init the global driver property of workspace.
  • Loading branch information
laeubi committed Feb 1, 2025
1 parent 6d565f3 commit 5c2d8c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ protected void execute(Project project) throws Exception {
getLog().info(String.format("Building sub bundle '%s'", subProject.getName()));
Jar jar = builder.build();
checkResult(builder, project.getWorkspace().isFailOk());
String jarName = jar.getName();
String name = subProject.getName();
File file = new File(mavenProject.getBuild().getDirectory(), String.format("%s.jar", jarName));
File file = project.getOutputFile(builder.getBsn(), builder.getVersion());
file.getParentFile().mkdirs();
jar.write(file);
helper.attachArtifact(mavenProject, "jar", name, file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;

import aQute.bnd.build.Workspace;

@Mojo(name = "initialize", defaultPhase = LifecyclePhase.INITIALIZE)
public class BndInitMojo extends AbstractMojo {

Expand Down Expand Up @@ -74,6 +76,7 @@ public class BndInitMojo extends AbstractMojo {

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
Workspace.setDriver("maven-tycho");
fixupPolyglot();
writeConsumerPom();
}
Expand Down

0 comments on commit 5c2d8c2

Please sign in to comment.