-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
fixes #1913 bnd-export-maven-plugin
produces stray generated
directory after execution
#1918
Conversation
@@ -81,6 +81,7 @@ private void export(File runFile) throws Exception { | |||
} | |||
run.setProperty(Constants.RUNBUNDLES, runBundles); | |||
} | |||
run.setProperty(Constants.DEFAULT_PROP_TARGET_DIR, targetDir.getAbsolutePath()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The correct thing to do is call run.setBase(new File(targetDir, "export/"+getNamePart(runFile)))
, at the start of the try block. So any directories that Project.prepare might create are in that folder.
@@ -111,6 +111,7 @@ private void testing(File runFile) throws Exception { | |||
String bndrun = getNamePart(runFile); | |||
File bndrunCwd = new File(cwd, bndrun); | |||
File bndrunResportsDir = new File(reportsDir, bndrun); | |||
run.setProperty(Constants.DEFAULT_PROP_TARGET_DIR, cwd.getAbsolutePath()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The correct thing to do is call run.setBase(new File(cwd, getNamePart(runFile)))
, at the start of the try block. So any directories that Project.prepare might create are in that folder.
Then you no longer need to set cwd since it is set by the setBase
call. I would then clean up the Bndrun.test
method signature to remove the cwd argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason your second statement is not working out. The tests are failing because the cwd
is not set. Shall I leave it set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[INFO] [ERROR] Failed to execute goal biz.aQute.bnd:bnd-testing-maven-plugin:3.4.0-SNAPSHOT:testing (testing) on project test-no-resolve: Working directory must be a directory: /home/rotty/projects/bnd/maven/bnd-testing-maven-plugin/target/integration-test/projects/test/test-no-resolve/target/test/test -> [Help 1]
[INFO] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal biz.aQute.bnd:bnd-testing-maven-plugin:3.4.0-SNAPSHOT:testing (testing) on project test-no-resolve: Working directory must be a directory: /home/rotty/projects/bnd/maven/bnd-testing-maven-plugin/target/integration-test/projects/test/test-no-resolve/target/test/test
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
[INFO] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[INFO] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
[INFO] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
[INFO] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
[INFO] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
[INFO] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[INFO] at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO] Caused by: org.apache.maven.plugin.MojoExecutionException: Working directory must be a directory: /home/rotty/projects/bnd/maven/bnd-testing-maven-plugin/target/integration-test/projects/test/test-no-resolve/target/test/test
[INFO] at aQute.bnd.maven.testing.plugin.TestingMojo.execute(TestingMojo.java:80)
[INFO] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
[INFO] ... 20 more
[INFO] Caused by: java.lang.IllegalArgumentException: Working directory must be a directory: /home/rotty/projects/bnd/maven/bnd-testing-maven-plugin/target/integration-test/projects/test/test-no-resolve/target/test/test
[INFO] at aQute.libg.command.Command.setCwd(Command.java:239)
[INFO] at aQute.bnd.build.ProjectLauncher.launch(ProjectLauncher.java:299)
[INFO] at aQute.launcher.plugin.ProjectLauncherImpl.launch(ProjectLauncherImpl.java:123)
[INFO] at aQute.tester.plugin.ProjectTesterImpl.test(ProjectTesterImpl.java:66)
[INFO] at biz.aQute.resolve.Bndrun.test(Bndrun.java:185)
[INFO] at aQute.bnd.maven.testing.plugin.TestingMojo.testing(TestingMojo.java:114)
[INFO] at aQute.bnd.maven.testing.plugin.TestingMojo.execute(TestingMojo.java:74)
[INFO] ... 22 more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or I can do projectTester.setCwd(getBase());
in Bndrun
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, the only thing required is to call getBase().mkdirs();
then everything works.
@rotty3000 While at it, could you guys also fix the stray 'run properties files' that export produces? |
That sounds like a separate item. What is that issue #? |
It is separate, but seems related (stray files) |
Updated! |
this didn't solve the issue with some directories! |
In the maven case executing tests now leaves behind a |
OK, let me look. We need to fix the root cause and not just apply band aids. |
this call is returning the root dir rather than the set base: |
Seems that without calling |
... maybe it's not because of that... |
https://github.com/bndtools/bnd/blob/master/biz.aQute.bndlib/src/aQute/bnd/build/ProjectLauncher.java#L96 sets cwd from base. |
The problem is the launch properties are messed up. Here's an example: the mvn project is: the launch properties contain:
the storage dir is the one messed up. |
Updated! |
@@ -64,6 +64,9 @@ private void export(File runFile) throws Exception { | |||
return; | |||
} | |||
try (Bndrun run = Bndrun.createBndrun(null, runFile)) { | |||
String bndrun = getNamePart(runFile); | |||
File bndrunBase = new File(targetDir, "export/" + bndrun); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the call to exportRunbundles
needs to change to use bndrunBase
instead of targetDir
as the argument. You do not want all the runbundles of all the bndrun files to dump their jars into one folder.
Updated! |
oops... fixing. |
…ed` directory after execution Signed-off-by: Raymond Auge <raymond.auge@liferay.com>
No description provided.