eclipse-tycho / tycho

Tycho project repository (tycho)
https://tycho.eclipseprojects.io
Eclipse Public License 2.0
170 stars 189 forks source link

package-plugin fails with target/classes does not exist #1079

Closed nitind closed 2 years ago

nitind commented 2 years ago

2.7.2 and 2.7.3 seem to fail when building some of my features and doc plug-ins, assuming that they should have compiled classes in a folder. Building with 2.7.1 succeeds.

Full trace on a doc plug-in (https://git.eclipse.org/c/servertools/webtools.servertools.git/tree/docs/org.eclipse.jst.server.ui.doc.user/pom.xml) failure, built with apache-maven-3.8.5, openjdk version "17.0.3" 2022-04-19, and Tycho 2.7.2 and 2.7.3:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:2.7.2:package-plugin (default-package-plugin) on project org.eclipse.jst.server.ui.doc.user: Execution default-package-plugin of goal org.eclipse.tycho:tycho-packaging-plugin:2.7.2:package-plugin failed: basedir /home/nitin/git/webtools.servertools/docs/org.eclipse.jst.server.ui.doc.user/target/classes does not exist -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:2.7.2:package-plugin (default-package-plugin) on project org.eclipse.jst.server.ui.doc.user: Execution default-package-plugin of goal org.eclipse.tycho:tycho-packaging-plugin:2.7.2:package-plugin failed: basedir /home/nitin/git/webtools.servertools/docs/org.eclipse.jst.server.ui.doc.user/target/classes does not exist
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:306)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:165)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:157)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:121)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:127)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-package-plugin of goal org.eclipse.tycho:tycho-packaging-plugin:2.7.2:package-plugin failed: basedir /home/nitin/git/webtools.servertools/docs/org.eclipse.jst.server.ui.doc.user/target/classes does not exist
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:301)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:165)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:157)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:121)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:127)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.IllegalStateException: basedir /home/nitin/git/webtools.servertools/docs/org.eclipse.jst.server.ui.doc.user/target/classes does not exist
    at org.codehaus.plexus.util.DirectoryScanner.scan (DirectoryScanner.java:281)
    at org.eclipse.tycho.packaging.IncludeValidationHelper.checkDir (IncludeValidationHelper.java:105)
    at org.eclipse.tycho.packaging.IncludeValidationHelper.checkIncludesExist (IncludeValidationHelper.java:79)
    at org.eclipse.tycho.packaging.IncludeValidationHelper.checkBinIncludesExist (IncludeValidationHelper.java:46)
    at org.eclipse.tycho.packaging.AbstractTychoPackagingMojo.checkBinIncludesExist (AbstractTychoPackagingMojo.java:135)
    at org.eclipse.tycho.packaging.PackagePluginMojo.createPluginJar (PackagePluginMojo.java:240)
    at org.eclipse.tycho.packaging.PackagePluginMojo.execute (PackagePluginMojo.java:172)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:301)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:165)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:157)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:121)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:127)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[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/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :org.eclipse.jst.server.ui.doc.user
laeubi commented 2 years ago

@nitind can you provide an integration-test to demonstrate the issue or example project?

michaelcompressconsult commented 2 years ago

same with 2.7.4, java 11.3. 12:12:07 [ERROR] Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:2.7.4:package-feature (default-package-feature) on project xxxx.feature: Execution default-package-feature of goal org.eclipse.tycho:tycho-packaging-plugin:2.7.4:package-feature failed: basedir /var/workspace/workspace/.../xxxx.feature/target/classes does not exist -> [Help 1]

this is a feature in a java project that contains just a feature.xml; there is no target.classes path in workspace as the plugins are compiled elsewhere. i also tried explicitely configuring basedir:

            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-packaging-plugin</artifactId>
                <configuration>
                    <basedir>${project.basedir}</basedir>
                </configuration>
            </plugin>

but it is still mentioning .../target/classes in the error message.

might be related to buggy update-consumer-pom - see https://www.eclipse.org/tycho/sitedocs/tycho-packaging-plugin/update-consumer-pom-mojo.html as adding

            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-packaging-plugin</artifactId>
                <configuration>
                    <skipPomGeneration>true</skipPomGeneration>
                </configuration>
            </plugin>

still shows in output: 12:32:18 [INFO] --- flatten-maven-plugin:1.2.7:flatten (flatten_pom) @ xxxxx.feature --- 12:32:18 [INFO] Generating flattened POM of project xxxxx.feature:eclipse-feature:24.0.1.08... 12:32:18 [INFO] 12:32:18 [INFO] --- tycho-packaging-plugin:2.7.4:update-consumer-pom (default-update-consumer-pom) @ xxxxx.feature --- 12:32:18 [INFO] 12:32:18 [INFO] --- tycho-packaging-plugin:2.7.4:package-feature (default-package-feature) @ xxxxx.feature ---

even binding the goal update-consumer-pom to phase none showed the phase to be run in the log

laeubi commented 2 years ago

flatten-maven-plugin:1.2.7:flatten (flatten_pom)

please note that flatten-maven-plugin:flatten != tycho-packaging:update-consumer-pom

michaelcompressconsult commented 2 years ago

read one line further - gust wanted to show i use the flatten plugin. 12:32:18 [INFO] --- tycho-packaging-plugin:2.7.4:update-consumer-pom (default-update-consumer-pom) @ xxxxx.feature ---

laeubi commented 2 years ago

read one line further - gust wanted to show i use the flatten plugin.

The mojo is always executed because it is part of the tycho-lifecycle but skipped if you ask for it see

https://github.com/eclipse/tycho/blob/e299728383fa4be6cfa5c62e49e7139df0b6315f/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/UpdateConsumerPomMojo.java#L96-L98

michaelcompressconsult commented 2 years ago

reviewed code there, looks ok.

laeubi commented 2 years ago

reviewed code there, looks ok.

That's why I asked for an integration-test to demonstrate the issue, its usually easier to see whats going on then if one has a minimal example.

michaelcompressconsult commented 2 years ago

checked location. https://github.com/eclipse/tycho/blob/f2b46160a4f7dd70641767778f41bcd35e024594/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/PackagePluginMojo.java#L239:~:text=//%203.%20handle%20nested,%5B0%5D))%3B problem is that my feature does not have any "nested jars and included resources" (basically just a feature.xml in the rootdir), so the directory the packaging misses is not created. Of course i can add an empty directory to version control, but do i really need to?

2.7.1 works for me.

nitind commented 2 years ago

That's why I asked for an integration-test to demonstrate the issue, its usually easier to see whats going on then if one has a minimal example.

I agree, however as I have no idea what's causing this regression, I don't know how to trigger it on purpose beyond "here's a large public repository we've been building for years where behavior is now broken."

laeubi commented 2 years ago

That's why I asked for an integration-test to demonstrate the issue, its usually easier to see whats going on then if one has a minimal example.

I agree, however as I have no idea what's causing this regression, I don't know how to trigger it on purpose beyond "here's a large public repository we've been building for years where behavior is now broken."

Usually one can take the large repo and try to reduce it e.g.:

  1. do the problem also happen when only building one module
  2. did it also happen if I remove certain content from that module
  3. do it happen for all or only a specific module
  4. can I create a bare empty example that works, and now adding more of my content
  5. ...
laeubi commented 2 years ago

By the way there was a fix here that sounds similar: https://github.com/eclipse-tycho/tycho/commit/0eb720ef75edc7f125b55f4c6e6fcf92e5714c6c

So please try out the current tycho snapshot build to check if the problem is fixed there.

nitind commented 2 years ago

By the way there was a fix here that sounds similar: 0eb720e

So please try out the current tycho snapshot build to check if the problem is fixed there.

The 2.7.5 release, which I think has this change, seems to no longer have the problem. I'm updating all of my build jobs to 2.7.5 to make sure.

laeubi commented 2 years ago

Yes the fix is part of Tycho 2.7.5

nitind commented 2 years ago

Confirmed, my jobs are all running properly with 2.7.5.