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.

(cherry picked from commit c87caeb)
  • Loading branch information
laeubi authored and eclipse-tycho-bot committed Feb 1, 2025
1 parent 6a2941e commit f3d3b5d
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("tycho-maven-build");
fixupPolyglot();
writeConsumerPom();
}
Expand Down

0 comments on commit f3d3b5d

Please sign in to comment.