Bukama opened a new issue, #104:
URL: https://github.com/apache/maven-jmod-plugin/issues/104

   ### Affected version
   
   3.0.1-SNAPSHOT (current master)
   
   ### Bug description
   
   _I already stumbled over this when upgrading to parent 48, but it turns out 
is has nothing to do with parent._
   
   Sorry in advanced for the long description, but its really strange and flaky 
for me using: **Windows 11, Java 25 (Zulu)**
   
   ### Summary
   
   Running IT `mjmod-20-set-main-class` with
   
   * Maven 3.9.16 and compiler-plugin 3.8.x works,
   * Maven 3.9.16 and compiler-plugin 3.9.0+ fails with "Failure during 
deleting of file" most of the time, rarely with "Module not found"
   * Maven Maven 4.0.0-rc5, compiler-plugin 3.8.x and no declared jar-plugin 
pulls in latest jar-plugin available in local repository
   * Maven Maven 4.0.0-rc5, compiler-plugin 3.8.x and parent's jar-plugin, 
fails almost every time with "Failure during deleting of file"
   * Maven Maven 4.0.0-rc5, compiler-plugin 3.15.0 and parent's jar-plugin 
fails with "Module not found"
   
   ### Long description / test results
   
   
   
   The easy part first / What I'm quite sure about:
   
   * It has nothing to do with using `clean` together with the verify (should 
be set via invoker.goals anyways, see below)
   * running the tests with admin rights or not.
   * changing the `invoker.goals` from `verify` to `package`. This is no 
surprise because running `verify` includes `package`, but I noticed that all 
other tests except those this and one other run `package` goal. Many of the 
others also run clean, but this does not seem to make any difference too.
   
   
   This is the current 
[POM](https://github.com/apache/maven-jmod-plugin/blob/master/src/it/mjmod-20-set-main-class/pom.xml),
 however the `compiler-plugin` is the one which causes trouble (from what I see 
and what is already described in the POM's comments)
   
   ```xml
   <pluginManagement>
     <plugins>
         <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-compiler-plugin</artifactId>
             <!-- When this version is not set to 3.8.0, but to 
@version.maven-compiler-plugin@ then jar-plugin 4.0.0-beta gets pulled in which 
is not defined anywhere, but is the latest in my local repository.
             4.0.0-beta ofc is not compatible with Maven 3.9.x.
             if you then set the jar-plugin to @version.maven-jar-plugin@, the 
java module (of the module-info) gets not found -->
             <version>3.8.0</version>
             <configuration>
                 <release>9</release>
             </configuration>
         </plugin>
         <!--
         <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-jar-plugin</artifactId>
             <version>@version.maven-jar-plugin@</version>
         </plugin>
         -->
     </plugins>
   </pluginManagement>
   ```
   
   ## Maven 3.9.16
   
   Using **Maven 3.9.16** it seems to be consistent, regardless of how often I 
run the tests with the same versions. I did the following tests:
   
   3.9.16 with compiler-plugin 3.8.0 (declared) and jar-plugin 3.5.0 (not 
declared as in current POM, pulled in from parent 48) --> ok
   
   3.9.16 with compiler-plugin 3.15.0 (declared using 
`@version.maven-compiler-plugin@`) pulls in jar plugin 4.0.0-beta-1 which is 
not declared anywhere, but is the latest version in my HOME/.m2 repo -> NOK / 
Maven version incompat
   
   ```
   [WARNING] Ignoring incompatible plugin version 4.0.0-beta-1
   org.apache.maven.plugin.PluginIncompatibleException: 
   The plugin org.apache.maven.plugins:maven-jar-plugin:4.0.0-beta-1 has unmet 
prerequisites: 
        Required Maven version 4.0.0-beta-3 is not met by current version 3.9.16
   ```
   
   3.9.16 with compiler-plugin 3.8.0 (declared) and jar-plugin 3.5.0 (declared 
using `@version.maven-jar-plugin@`) --> ok
   
   3.9.16 with compiler-plugin 3.15.0 (declared using 
`@version.maven-compiler-plugin@`) and jar-plugin 3.5.0 (declared using 
`@version.maven-jar-plugin@`) --> NOK / Failure during deleting of file
   
   ```
   Caused by: org.apache.maven.plugin.MojoFailureException: Failure during 
deleting of file 
D:\Github\Maven\maven-jmod-plugin\target\it\mjmod-20-set-main-class\world\target\jmods\myproject.world.jmod
       at 
org.apache.maven.plugins.jmod.JModCreateMojo.deleteOutputIfAlreadyExists 
(JModCreateMojo.java:345)
       at org.apache.maven.plugins.jmod.JModCreateMojo.execute 
(JModCreateMojo.java:316)
       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:919)
       at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:285)
       at org.apache.maven.cli.MavenCli.main (MavenCli.java:207)
       at jdk.internal.reflect.DirectMethodHandleAccessor.invoke 
(DirectMethodHandleAccessor.java:104)
       at java.lang.reflect.Method.invoke (Method.java:565)
       at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced 
(Launcher.java:255)
       at org.codehaus.plexus.classworlds.launcher.Launcher.launch 
(Launcher.java:201)
       at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode 
(Launcher.java:362)
       at org.codehaus.plexus.classworlds.launcher.Launcher.main 
(Launcher.java:314)
   ```
   
   This shows that there must be a problem with compiler plugin somewhere. So 
testing other versions of it.
   
   3.9.16 with compiler-plugin 3.8.1 (declared) and jar-plugin 3.5.0 (declared 
using `@version.maven-jar-plugin@`) --> OK
   
   3.9.16 with compiler-plugin 3.9.0 (declared) and jar-plugin 3.5.0 (declared 
using `@version.maven-jar-plugin@`) --> NOK / "Failure during deleting of file" 
(99% of the time) OR "Module not found"
   
   ```
   org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute 
goal org.apache.maven.plugins:maven-compiler-plugin:3.15.0:compile 
(default-compile) on project myproject.greetings: Compilation failure
   
/D:/Github/Maven/maven-jmod-plugin/target/it/mjmod-20-set-main-class/greetings/src/main/java/module-info.java:[21,23]
 Modul nicht gefunden: myproject.world
   ```
   
   The same is true for all my test with other compiler version higher then 
3.8.1, starting from 3.9.0 up to current 3.15.0. Seems there is at least one 
problem with compiler-plugin 3.9.0+ when using Maven 3.9.16 in this IT.
   
   ## Maven 4.0.0-rc5
   
   When using **Maven 4.0.0-rc5** its getting a bit flaky, but most of the time 
it fails
   
   4.0.0-rc5 with compiler-plugin 3.8.0 (declared) and jar-plugin 3.5.0 
(declared using `@version.maven-jar-plugin@`) --> NOK / Failure during deleting 
of file 
   
   Most of the runs it fails with the "Failure during deleting of file" error. 
In very few runs (maybe 2 or 3 out of 30+) the build is successful and only the 
output in build-info does not match the expected (which is okay and what I want 
to check for Maven 4 compat. I think I have a fix for the changed output, but 
this is another topic).
   
   When running 4.0.0-rc5 with compiler-plugin version of 3.15.0 (declared 
using `@version.maven-compiler-plugin@`) and jar-plugin 3.5.0 (declared using 
`@version.maven-jar-plugin@`) the behavior changes and I constantly get a 
"Module not found"
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to