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

Use tycho-compiler-plugin to compile for Java 20 (and --enable-preview) #2324

Closed
minduch opened this issue Apr 5, 2023 · 7 comments
Closed
Milestone

Comments

@minduch
Copy link

minduch commented Apr 5, 2023

We have tried long and hard to get this to work. We have tried Tycho 3.0.4, 3.0.5-SNAPSHOT, 3.10-SNAPSHOT, 4.0.0-SNAPSHOT, but it just doesn't work or we don't know how to use e.g. javac from Temurin-20+36 or alike. We use toolchains, and they have been working perfectly the last years.

All our projects require JavaSE-20 + --enable-preview and are Eclipse plugin projects.
Replace ${tycho.version} below with 3.0.4 or one of the SNAPSHOT versions above, it will not make a change.

      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-compiler-plugin</artifactId>
        <version>${tycho.version}</version>
        <configuration>
          <useProjectSettings>true</useProjectSettings>
          <optimize>true</optimize>
          <debug>true</debug> <!-- ProGuard takes away the debug info -->
          <encoding>UTF-8</encoding>
          <compilerArgument>-g</compilerArgument>  <!-- ProGuard takes away the debug info -->
          <compilerArgument>--enable-preview</compilerArgument>
          <compilerArgument>--release</compilerArgument>
          <compilerArgument>20</compilerArgument>
          <compilerArgument>-warn:none</compilerArgument>
          <compilerArgument>-err:none</compilerArgument>
          <release>20</release>
          <verbose>true</verbose>
        </configuration>
      </plugin>

Basically, the Java version 20 is not accepted: target level should be in '1.1'...'1.8','9'...'19' (or '5.0'..'19.0') or cldc1.1: 20.

The result from a Maven build looks like:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:3.0.4:compile (default-compile) on project com.iizix.txp: Fatal error compiling: Failure executing ejc, but could not parse the error:
[ERROR] target level should be in '1.1'...'1.8','9'...'19' (or '5.0'..'19.0') or cldc1.1: 20
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:3.0.4:compile (default-compile) on project com.iizix.txp: Fatal error compiling
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:347)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
    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:827)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:272)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:195)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:578)
    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.MojoExecutionException: Fatal error compiling
    at copied.org.apache.maven.plugin.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:417)
    at org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo.doCompile (AbstractOsgiCompilerMojo.java:370)
    at org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo.execute (AbstractOsgiCompilerMojo.java:351)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
    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:827)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:272)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:195)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:578)
    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.codehaus.plexus.compiler.CompilerException: Failure executing ejc, but could not parse the error:
target level should be in '1.1'...'1.8','9'...'19' (or '5.0'..'19.0') or cldc1.1: 20

    at org.eclipse.tycho.compiler.jdt.JDTCompiler.compileOutOfProcess (JDTCompiler.java:351)
    at org.eclipse.tycho.compiler.jdt.JDTCompiler.performCompile (JDTCompiler.java:117)
    at copied.org.apache.maven.plugin.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:414)
    at org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo.doCompile (AbstractOsgiCompilerMojo.java:370)
    at org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo.execute (AbstractOsgiCompilerMojo.java:351)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
...etc...
@minduch
Copy link
Author

minduch commented Apr 5, 2023

Previously we used Java 19 (which obviously is in the list of acceptable target levels target level should be in '1.1'...'1.8','9'...'19' (or '5.0'..'19.0') or cldc1.1), and this worked just fine with --enable-preview. The problem we face is now Java 20.

We are using latest Maven 3.9.1.

@laeubi
Copy link
Member

laeubi commented Apr 5, 2023

or we don't know how to use e.g. javac from Temurin-20+36 or alike.

Tycho does not use javac but ecj that seem to not support java 20 yet but will after the next release (in June 2023), there is an option to use other compilers:

https://tycho.eclipseprojects.io/doc/latest/tycho-compiler-plugin/compile-mojo.html#compilerId

but I suspect this is experimental/unsupported as I can't find a single example / test in Tycho that actually uses javac.

So the question would be how important that is for you and how much effort you want to put into this or if it is an option to just wait for the next ejc release.

@minduch
Copy link
Author

minduch commented Apr 5, 2023

Hi, I know about the https://tycho.eclipseprojects.io/doc/latest/tycho-compiler-plugin/compile-mojo.html#compilerId, but I can't see to get any to work.

It is most urgent for us to be able to compile now and cannot wait until June.

We will use next Eclipse 2023-06 M1 as soon as it is available (end of week I think), but that will probably not resolve our Maven build problems.

What is the compilerId that should be set, and how should it be configured? What other compilerId's are available, and do you have an example?

Would it otherwise be possible to set-up javac as the compilerId and how is this done? I can't find any documentation about it.

@laeubi
Copy link
Member

laeubi commented Apr 5, 2023

Would it otherwise be possible to set-up javac as the compilerId and how is this done? I can't find any documentation about it.

As said I think no one ever tried that and it is probably even not possible at all, but if this is crucial to your business and likes to speed up the development in that area a sponsoring would allow me to assign more time-slots particular issue, or you can contact me to enter a contract to implement a specific feature.

We will use next Eclipse 2023-06 M1 as soon as it is available (end of week I think), but that will probably not resolve our Maven build problems.

The main problem is that Milestones are not deployed to central see this topic:

But if we assume that M1 contains the necessary stuff and you can use the above mentioned snapshot repository, it should be possible to use the snapshot until june and configure Tycho like this:

<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>tycho-compiler-plugin</artifactId>
  <version>${tycho-version}</version>
  <dependencies>
    <dependency>
      <groupId>org.eclipse.jdt</groupId>
      <artifactId>ecj</artifactId>
      <version>3.34.0-SNAPSHOT</version>
    </dependency>
  </dependencies>
</plugin>

@minduch
Copy link
Author

minduch commented Apr 5, 2023

For now it doesn't work. Perhaps I have done something wrong.

This is what I did in the beginning of our main pom.xml:

  <!-- Eclipse ecj compiler SNAPSHOT for Java 20 -->
  <pluginRepositories>
    <pluginRepository>
      <id>org.eclipse.ecj-3.34.0-SNAPSHOT</id>
      <url>https://repo.eclipse.org/content/repositories/eclipse-snapshots/org/eclipse/jdt/ecj/3.34.0-SNAPSHOT/</url>
    </pluginRepository>
  </pluginRepositories>

And then the modified and cleaned up tycho-compiler-plugin, where the properties ${tycho.version} is set to 3.0.4 and ${java.complier.release.version} is set to 20:

      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-compiler-plugin</artifactId>
        <version>${tycho.version}</version>
        <!-- Temp fix until 2023-06 is released - BEGIN -->
        <dependencies>
          <dependency>
            <groupId>org.eclipse.jdt</groupId>
            <artifactId>ecj</artifactId>
            <version>3.34.0-SNAPSHOT</version>
          </dependency>
        </dependencies>
        <!-- Temp fix until 2023-06 is released - END -->
        <configuration>
          <useProjectSettings>true</useProjectSettings>
          <optimize>true</optimize>
          <debug>true</debug> <!-- ProGuard takes away the debug info -->
          <encoding>UTF-8</encoding>
          <release>${java.complier.release.version}</release>
          <compilerArgument>--enable-preview</compilerArgument>
          <verbose>true</verbose>
        </configuration>
      </plugin>

The Maven build picks up and reads the definitions from the pluginrepository https://repo.eclipse.org/content/repositories/eclipse-snapshots/org/eclipse/jdt/ecj/3.34.0-SNAPSHOT/, but now it fails as shown below:

Did I do something wrong, or are there just missing things in the ecj-3.34.0-SNAPSHOT?

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:3.0.4:validate-classpath (default-validate-classpath) on project com.iizix.txp: Execution default-validate-classpath of goal org.eclipse.tycho:tycho-compiler-plugin:3.0.4:validate-classpath failed: Plugin org.eclipse.tycho:tycho-compiler-plugin:3.0.4 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.eclipse.jdt:ecj:jar:3.34.0-SNAPSHOT (absent): Could not find artifact org.eclipse.jdt:ecj:jar:3.34.0-SNAPSHOT in org.eclipse.ecj-3.34.0-SNAPSHOT (https://repo.eclipse.org/content/repositories/eclipse-snapshots/org/eclipse/jdt/ecj/3.34.0-SNAPSHOT/) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:3.0.4:validate-classpath (default-validate-classpath) on project com.iizix.txp: Execution default-validate-classpath of goal org.eclipse.tycho:tycho-compiler-plugin:3.0.4:validate-classpath failed: Plugin org.eclipse.tycho:tycho-compiler-plugin:3.0.4 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.eclipse.jdt:ecj:jar:3.34.0-SNAPSHOT (absent): Could not find artifact org.eclipse.jdt:ecj:jar:3.34.0-SNAPSHOT in org.eclipse.ecj-3.34.0-SNAPSHOT (https://repo.eclipse.org/content/repositories/eclipse-snapshots/org/eclipse/jdt/ecj/3.34.0-SNAPSHOT/)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:347)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
    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:827)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:272)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:195)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:578)
    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-validate-classpath of goal org.eclipse.tycho:tycho-compiler-plugin:3.0.4:validate-classpath failed: Plugin org.eclipse.tycho:tycho-compiler-plugin:3.0.4 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.eclipse.jdt:ecj:jar:3.34.0-SNAPSHOT (absent): Could not find artifact org.eclipse.jdt:ecj:jar:3.34.0-SNAPSHOT in org.eclipse.ecj-3.34.0-SNAPSHOT (https://repo.eclipse.org/content/repositories/eclipse-snapshots/org/eclipse/jdt/ecj/3.34.0-SNAPSHOT/)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:100)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
    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:827)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:272)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:195)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:578)
    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.PluginResolutionException: Plugin org.eclipse.tycho:tycho-compiler-plugin:3.0.4 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.eclipse.jdt:ecj:jar:3.34.0-SNAPSHOT (absent): Could not find artifact org.eclipse.jdt:ecj:jar:3.34.0-SNAPSHOT in org.eclipse.ecj-3.34.0-SNAPSHOT (https://repo.eclipse.org/content/repositories/eclipse-snapshots/org/eclipse/jdt/ecj/3.34.0-SNAPSHOT/)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolveInternal (DefaultPluginDependenciesResolver.java:216)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve (DefaultPluginDependenciesResolver.java:158)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.createPluginRealm (DefaultMavenPluginManager.java:372)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.lambda$setupPluginRealm$1 (DefaultMavenPluginManager.java:335)
    at org.apache.maven.plugin.DefaultPluginRealmCache.lambda$get$0 (DefaultPluginRealmCache.java:156)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent (ConcurrentHashMap.java:1708)
    at org.apache.maven.plugin.DefaultPluginRealmCache.get (DefaultPluginRealmCache.java:154)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.setupPluginRealm (DefaultMavenPluginManager.java:334)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getPluginRealm (DefaultBuildPluginManager.java:205)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:98)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
    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:827)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:272)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:195)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:578)
    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.eclipse.aether.resolution.ArtifactResolutionException: The following artifacts could not be resolved: org.eclipse.jdt:ecj:jar:3.34.0-SNAPSHOT (absent): Could not find artifact org.eclipse.jdt:ecj:jar:3.34.0-SNAPSHOT in org.eclipse.ecj-3.34.0-SNAPSHOT (https://repo.eclipse.org/content/repositories/eclipse-snapshots/org/eclipse/jdt/ecj/3.34.0-SNAPSHOT/)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve (DefaultArtifactResolver.java:456)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts (DefaultArtifactResolver.java:261)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies (DefaultRepositorySystem.java:352)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolveInternal (DefaultPluginDependenciesResolver.java:212)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve (DefaultPluginDependenciesResolver.java:158)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.createPluginRealm (DefaultMavenPluginManager.java:372)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.lambda$setupPluginRealm$1 (DefaultMavenPluginManager.java:335)
    at org.apache.maven.plugin.DefaultPluginRealmCache.lambda$get$0 (DefaultPluginRealmCache.java:156)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent (ConcurrentHashMap.java:1708)
    at org.apache.maven.plugin.DefaultPluginRealmCache.get (DefaultPluginRealmCache.java:154)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.setupPluginRealm (DefaultMavenPluginManager.java:334)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getPluginRealm (DefaultBuildPluginManager.java:205)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:98)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
    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:827)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:272)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:195)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:578)
    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.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact org.eclipse.jdt:ecj:jar:3.34.0-SNAPSHOT in org.eclipse.ecj-3.34.0-SNAPSHOT (https://repo.eclipse.org/content/repositories/eclipse-snapshots/org/eclipse/jdt/ecj/3.34.0-SNAPSHOT/)
    at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed (ArtifactTransportListener.java:42)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run (BasicRepositoryConnector.java:417)
...etc...

@laeubi
Copy link
Member

laeubi commented Apr 5, 2023

The repo name URL for the snapshot should be https://repo.eclipse.org/content/repositories/eclipse-snapshots/
And you maybe need to enable to fetch snapshots for the repo.

@minduch
Copy link
Author

minduch commented Apr 5, 2023

This definition in the beginning of the main pom.xml along with the tycho-compiler-plugin config below made it work.

We now build a a version of our product IIZI based on Eclipse 2023-03 + patch for Java 20 for Win64, macOS Intel+Apple and Linux aarch64+x86-64 with JustJ version 20.0.0 and Jetty version 12 (!) beta0 (Jakarta EE 10+9+8, etc), all using Java 20 with preview features enabled and using virtual threads...

We target the release when Jetty12 is ready along with Java 21, so I guess our IIZI product will be based on Eclipse 2023-09 or 2023-12.

Thank you for your help!

  <!-- Eclipse SNAPSHOTS -->
  <pluginRepositories>
    <pluginRepository>
      <id>org.eclipse.SNAPSHOTS</id>
      <url>https://repo.eclipse.org/content/repositories/eclipse-snapshots/</url>
    </pluginRepository>
  </pluginRepositories>

The plugin definition lower down in the main pom.xml:

      <!-- Tycho Compile plugin projects -->
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-compiler-plugin</artifactId>
        <version>${tycho.version}</version>
        <!-- Temp fix until 2023-06 is released - BEGIN -->
        <dependencies>
          <dependency>
            <groupId>org.eclipse.jdt</groupId>
            <artifactId>ecj</artifactId>
            <version>3.34.0-SNAPSHOT</version>
          </dependency>
        </dependencies>
        <!-- Temp fix until 2023-06 is released - END -->
        <configuration>
          <useProjectSettings>true</useProjectSettings>
          <optimize>true</optimize>
          <debug>true</debug> <!-- ProGuard takes away the debug info -->
          <encoding>UTF-8</encoding>
          <release>${java.complier.release.version}</release>
          <compilerArgument>--enable-preview</compilerArgument>
          <compilerArgument>-warn:none</compilerArgument>
          <compilerArgument>-err:none</compilerArgument>
          <verbose>true</verbose>
        </configuration>
      </plugin>

@minduch minduch closed this as completed Apr 5, 2023
@laeubi laeubi added this to the 4.0 milestone Jun 24, 2023
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