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

Issues with copyDependencies of artifact built within multi-module reactor build #1752

Open
ThomasHurek opened this issue Oct 31, 2023 · 12 comments

Comments

@ThomasHurek
Copy link

Since upgrading to the latest version of the Eclipse plugin 23.0.9 and trying to use the Liberty Dashboard start command the following error occurs:
[ERROR] Failed to execute goal io.openliberty.tools:liberty-maven-plugin:3.9:dev (default-cli) on project engine-ear: Unable to execute mojo: Execution null of goal io.openliberty.tools:liberty-maven-plugin:3.9:create failed: Use a resource collection to copy directories. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :engine-ear

When removing the copyDependencies the plugin seems to succeed but missing the files that would be copied.

Section from pom.xml:

        <plugin>
            <groupId>io.openliberty.tools</groupId>
            <artifactId>liberty-maven-plugin</artifactId>
            <version>3.9</version>
            <configuration>
                <assemblyArtifact>
                    <groupId>io.openliberty</groupId>
                    <artifactId>openliberty-runtime</artifactId>
                    <version>23.0.0.3</version>
                    <type>zip</type>
                </assemblyArtifact>
                <copyDependencies>
					<dependencyGroup>
			          <location>resources/dblib</location>
			          <dependency>
						<groupId>org.apache.derby</groupId>
						<artifactId>derby</artifactId>
						<version>10.15.2.0</version>
						<type>jar</type>
					</dependency>
					<dependency>
						<groupId>org.apache.derby</groupId>
						<artifactId>derbytools</artifactId>
						<version>10.15.2.0</version>
						<type>jar</type>
					</dependency>
					<dependency>
						<groupId>org.apache.derby</groupId>
						<artifactId>derbyshared</artifactId>
						<version>10.15.2.0</version>
						<type>jar</type>
					</dependency>
			        </dependencyGroup>
                    <dependencyGroup>
                        <location>resources/dxcoreLib</location>
                        <dependency>
                            <groupId>hcl.dxcore-new</groupId>
                            <artifactId>aggregator-manager</artifactId>
                            <version>0.0.1-SNAPSHOT</version>
                            <type>jar</type>
                        </dependency>
                      </dependencyGroup>
                      <dependencyGroup>
                        <stripVersion>true</stripVersion>
                        <location>resources/portlets</location>
				        <dependency>
				            <groupId>hcl.dx.ap</groupId>
				            <artifactId>CredentialAdministration</artifactId>
				            <version>1.0</version>
				            <type>war</type>
				        </dependency>
                      </dependencyGroup>
			      </copyDependencies>
                <serverName>engineServer</serverName>
                <appsDirectory>apps</appsDirectory>
            </configuration>
        </plugin>
@scottkurz
Copy link
Member

scottkurz commented Nov 1, 2023

Thanks @ThomasHurek for reporting this issue.

Would you be willing to collect more logging by running with the "Start ..." and adding the -e parameter and sharing the exception stack trace as well as the version of mvn you're using (mvn -v) ? If nothing in the project is particularly sensitive, perhaps you'd also be willing to run with the -X parm and share that output as well?

The Liberty Tools Eclipse IDE tooling provides only a thin wrapper around the underlying liberty-maven-plugin "dev mode", so I'd expect the same issue would exist either inside the IDE or outside (e.g. from a shell via mvn CLI). If you get the chance maybe you could try that.

Does the problem go away or reappear based on doing a clean (or not doing a clean)? (There is no way to do this currently using the IDE tooling, you'd have to use a separate CLI shell or use the "m2e" Maven support in Eclipse).

@ThomasHurek
Copy link
Author

@scottkurz Thx for taking a look at the issue. Attaching the requested output:

mvn -version
Apache Maven 3.9.4 (dfbb324ad4a7c8fb0bf182e6d91b0ae20e3d2dd9)
Maven home: /opt/homebrew/Cellar/maven/3.9.4/libexec
Java version: 11.0.18, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "12.6.8", arch: "aarch64", family: "mac"

Exception stack:

[ERROR] Failed to execute goal io.openliberty.tools:liberty-maven-plugin:3.7.1:dev (default-cli) on project engine-ear: Use a resource collection to copy directories. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.openliberty.tools:liberty-maven-plugin:3.7.1:dev (default-cli) on project engine-ear: Use a resource collection to copy directories.
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
Caused by: org.apache.maven.plugin.MojoExecutionException: Use a resource collection to copy directories.
at org.codehaus.mojo.pluginsupport.MojoSupport.execute (MojoSupport.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
Caused by: org.apache.maven.plugin.MojoExecutionException: Use a resource collection to copy directories.
at org.codehaus.mojo.pluginsupport.MojoSupport.execute (MojoSupport.java:137)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.twdata.maven.mojoexecutor.MojoExecutor.executeMojo (MojoExecutor.java:120)
at io.openliberty.tools.maven.server.StartDebugMojoSupport.runLibertyMojo (StartDebugMojoSupport.java:363)
at io.openliberty.tools.maven.server.StartDebugMojoSupport.runLibertyMojoCreate (StartDebugMojoSupport.java:308)
at io.openliberty.tools.maven.server.DevMojo.runLibertyMojoCreate (DevMojo.java:1931)
at io.openliberty.tools.maven.server.DevMojo.doExecute (DevMojo.java:1326)
at org.codehaus.mojo.pluginsupport.MojoSupport.execute (MojoSupport.java:122)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
Caused by: org.apache.tools.ant.BuildException: Use a resource collection to copy directories.
at org.apache.tools.ant.taskdefs.Copy.validateAttributes (Copy.java:689)
at org.apache.tools.ant.taskdefs.Copy.execute (Copy.java:450)
at io.openliberty.tools.maven.server.StartDebugMojoSupport.copyDependencies (StartDebugMojoSupport.java:472)
at io.openliberty.tools.maven.server.StartDebugMojoSupport.copyDependencies (StartDebugMojoSupport.java:412)
at io.openliberty.tools.maven.server.StartDebugMojoSupport.copyConfigFiles (StartDebugMojoSupport.java:652)
at io.openliberty.tools.maven.server.CreateServerMojo.doExecute (CreateServerMojo.java:88)
at org.codehaus.mojo.pluginsupport.MojoSupport.execute (MojoSupport.java:122)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.twdata.maven.mojoexecutor.MojoExecutor.executeMojo (MojoExecutor.java:120)
at io.openliberty.tools.maven.server.StartDebugMojoSupport.runLibertyMojo (StartDebugMojoSupport.java:363)
at io.openliberty.tools.maven.server.StartDebugMojoSupport.runLibertyMojoCreate (StartDebugMojoSupport.java:308)
at io.openliberty.tools.maven.server.DevMojo.runLibertyMojoCreate (DevMojo.java:1931)
at io.openliberty.tools.maven.server.DevMojo.doExecute (DevMojo.java:1326)
at org.codehaus.mojo.pluginsupport.MojoSupport.execute (MojoSupport.java:122)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :engine-ear

@ThomasHurek
Copy link
Author

I tried with clean and without clean and the same issue happens:

[ERROR] Failed to execute goal io.openliberty.tools:liberty-maven-plugin:3.7.1:dev (default-cli) on project engine-ear: Use a resource collection to copy directories. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.openliberty.tools:liberty-maven-plugin:3.7.1:dev (default-cli) on project engine-ear: Use a resource collection to copy directories.
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
Caused by: org.apache.maven.plugin.MojoExecutionException: Use a resource collection to copy directories.
at org.codehaus.mojo.pluginsupport.MojoSupport.execute (MojoSupport.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
Caused by: org.apache.maven.plugin.MojoExecutionException: Use a resource collection to copy directories.
at org.codehaus.mojo.pluginsupport.MojoSupport.execute (MojoSupport.java:137)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.twdata.maven.mojoexecutor.MojoExecutor.executeMojo (MojoExecutor.java:120)
at io.openliberty.tools.maven.server.StartDebugMojoSupport.runLibertyMojo (StartDebugMojoSupport.java:363)
at io.openliberty.tools.maven.server.StartDebugMojoSupport.runLibertyMojoCreate (StartDebugMojoSupport.java:308)
at io.openliberty.tools.maven.server.DevMojo.runLibertyMojoCreate (DevMojo.java:1931)
at io.openliberty.tools.maven.server.DevMojo.doExecute (DevMojo.java:1326)
at org.codehaus.mojo.pluginsupport.MojoSupport.execute (MojoSupport.java:122)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
Caused by: org.apache.tools.ant.BuildException: Use a resource collection to copy directories.
at org.apache.tools.ant.taskdefs.Copy.validateAttributes (Copy.java:689)
at org.apache.tools.ant.taskdefs.Copy.execute (Copy.java:450)
at io.openliberty.tools.maven.server.StartDebugMojoSupport.copyDependencies (StartDebugMojoSupport.java:472)
at io.openliberty.tools.maven.server.StartDebugMojoSupport.copyDependencies (StartDebugMojoSupport.java:412)
at io.openliberty.tools.maven.server.StartDebugMojoSupport.copyConfigFiles (StartDebugMojoSupport.java:652)
at io.openliberty.tools.maven.server.CreateServerMojo.doExecute (CreateServerMojo.java:88)
at org.codehaus.mojo.pluginsupport.MojoSupport.execute (MojoSupport.java:122)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.twdata.maven.mojoexecutor.MojoExecutor.executeMojo (MojoExecutor.java:120)
at io.openliberty.tools.maven.server.StartDebugMojoSupport.runLibertyMojo (StartDebugMojoSupport.java:363)
at io.openliberty.tools.maven.server.StartDebugMojoSupport.runLibertyMojoCreate (StartDebugMojoSupport.java:308)
at io.openliberty.tools.maven.server.DevMojo.runLibertyMojoCreate (DevMojo.java:1931)
at io.openliberty.tools.maven.server.DevMojo.doExecute (DevMojo.java:1326)
at org.codehaus.mojo.pluginsupport.MojoSupport.execute (MojoSupport.java:122)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :engine-ear

@ThomasHurek
Copy link
Author

Seems the logs are not pasted complete so pasting as file.
output.log

@scottkurz
Copy link
Member

scottkurz commented Nov 1, 2023

@ThomasHurek thanks for the logs.

It seems from the exception that one of the dependencies included via the copyDependencies config resolves to a directory location. This could be a dependency listed directly, or more likely, transitively (the name "aggregator-manager" suggests this might aggregate a number of dependencies).

Do you happen to have any guess as to which dependency this might be?

I wonder if it is one of the standard packaging types or something custom perhaps, or at least less common.

The log seems like it got truncated, unfortunately, so I can't really draw any conclusions from that.

Did you happen to have a chance to try recreating outside of Liberty Tools Eclipse?

Thanks.

@ThomasHurek
Copy link
Author

I tried mvn liberty:dev (after triggering a build of all components with mvn install) and it starts fine:

[INFO] CWWKM2015I: Match number: 1 is [11/1/23, 17:33:29:420 EDT] 00000026 com.ibm.ws.kernel.feature.internal.FeatureManager A CWWKF0011I: The engineServer server is ready to run a smarter planet. The engineServer server started in 30.721 seconds..
[INFO] ************************************************************************
[INFO] * Liberty is running in dev mode.
[INFO] * Automatic generation of features: [ Off ]
[INFO] * h - see the help menu for available actions, type 'h' and press Enter.
[INFO] * q - stop the server and quit dev mode, press Ctrl-C or type 'q' and press Enter.
[INFO] *
[INFO] * Liberty server port information:
[INFO] * Liberty server HTTP port: [ 9080 ]
[INFO] * Liberty server HTTPS port: [ 9443 ]
[INFO] * Liberty debug port: [ 50218 ]
[INFO] ************************************************************************

@ThomasHurek
Copy link
Author

ThomasHurek commented Nov 1, 2023

Yes the aggregator-manager is used for gathering transitive dependencies. It is pretty straightforward but it does use exclusions like:

                  <exclusion>
                        <groupId>hcl.dx.bla</groupId>
                        <artifactId>webservices</artifactId>
                  </exclusion>

@scottkurz
Copy link
Member

OK, I think I have an idea what type of problem we're dealing with.

This is a bit long but let me leave some notes to consider.

OBSERVATION

You appear to be doing a multi-module build, and the dependency you're copying via <copyDependencies> is also being built in this same multi-module build.

I'm observing this looking at the build output:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for DX Core Engine 0.0.1-SNAPSHOT:
....
[INFO] aggregator-manager ................................. SUCCESS [  0.192 s]
...

[INFO] pzn-war ............................................ SUCCESS [  0.462 s]
[INFO] EAR Module ......................................... FAILURE [  2.323 s]
[INFO] ------------------------------------------------------------------------

as this 'aggregator-manager' matches the artifactId in one of your <copyDependencies> entries.

MULTI-MODULE BEHAVIOR EXPLAINED

In some contexts, the Maven APIs we're using in liberty-maven-plugin will associate a Maven artifact with the path of the locally-installed artifact. This is what would be used for a completely external dependency.

In certain multi-module contexts, though,Maven will associate the artifact with its output directory, e.g. target/classes.

This makes sense if you stop to think about how mvn compile would work. If Maven needed to use a locally installed artifact to compile against then you'd have to do mvn install with each component of the dependency graph before you could compile against it, and it would make multi-module builds a lot more difficult to work with.

RECREATE

Anyway, I can now easily recreate a problem like this by taking the multi-module guide app: https://github.com/OpenLiberty/guide-maven-multimodules and adding to its ear module the liberty-maven-plugin config:

       <copyDependencies>
	  <dependency>
            <groupId>io.openliberty.guides</groupId>
            <artifactId>guide-maven-multimodules-jar</artifactId>
	 </dependency>
	</copyDependencies>

and then doing a multi-module mvn liberty:dev.

In fact, doing a mvn install doesn't make this problem go away. So there must be something a bit different about your scenario.

And the scenario I constructed is in fact kind of unrealistic. The guide-maven-multimodules-jar in this case is already going to be packaged within the WAR within the application EAR, so there's no value or need to use to move the binary into place like I did here.

The copyDependencies function was originally developed with a use case more like "copy a provided-scoped JDBC driver dependency into place", since such a dependency would NOT get packaged within the building of the EAR/WAR.

NEXT STEPS

I have to stop here for the day without having gotten to what the next step should be, but let me just paste that analysis for now, regardless.

@scottkurz scottkurz transferred this issue from OpenLiberty/liberty-tools-eclipse Nov 1, 2023
@scottkurz scottkurz changed the title copyDependencies no longer working with eclipse plugin Issues with copyDependencies of artifact built within multi-module reactor build Nov 1, 2023
@scottkurz
Copy link
Member

I don't think this change broke anything (I think the basic issue exists before and after this was merged), but this PR: #1570 overlapped some of the constructs here (the output dir in a multi-mod build)..so might be something to learn from.

@ThomasHurek
Copy link
Author

Yes you are totally right it is a multi-module setup. The ear module sits in parallel with various other modules.

@scottkurz
Copy link
Member

Yes you are totally right it is a multi-module setup. The ear module sits in parallel with various other modules.

So how do the contents in aggregator-manager get used? Via some kind of global/shared library or resource (JDBC) library?

If, OTOH, they are just application-level libraries then I wonder if you should by using copyDependencies vs. just packaging them into the app (EAR).

@ThomasHurek
Copy link
Author

They are used in multiple shared libraries.

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