random-maven / flatten-maven-plugin

Simplify maven project descriptor for artifact deployment
https://random-maven.github.io/flatten-maven-plugin/flatten-mojo.html
Other
9 stars 5 forks source link

Release latest version >=1.1.20171201044135? #1

Closed tribbloid closed 6 years ago

tribbloid commented 6 years ago

The released version is still:

com.carrotgarden.maven flatten-maven-plugin 1.0.20171129163300

Which excludes features merged at Dec. 1 for scala cross-compilation.

Any plan to release it on maven central? The release of one of my scala project depends on it.

Andrei-Pozolotin commented 6 years ago

1) released 1.1.20171204015648

2) may I ask which projects will you release with this?

tribbloid commented 6 years ago

Thanks a lot! The project is https://github.com/tribbloid/spookystuff, version number is 0.4.0

tribbloid commented 6 years ago

Just test it, the flattened pom file looks good to me. However there are 2 issues that may affects its usability:

  1. The pom.xml file in the jar/META-INF is still the unflattened version (mojohaus version use the flattened version automatically), not sure of the impact though as META-INF should be ignored by most package manager

  2. The flattened pom.xml will be ignored by maven-install-plugin! This definitely has negative impact if one use local .m2 repository extensively (shouldn't affect remote or staging). Maybe we'll have to submit a patch to maven-install-plugin as well. Hopefully this won't become a cluster of mess.

Andrei-Pozolotin commented 6 years ago
  1. META-INF : will take a look

  2. install:install : actually works, by default, see integration test: https://github.com/random-maven/flatten-maven-plugin/blob/master/src/it/test-1/pom.xml

    [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ flatten-maven-plugin-test-1 ---
    [INFO] [INFO] Installing /home/work/source/git/flatten-maven-plugin/target/it/test-1/target/flatten-maven-plugin-test-1-0.20171204203052.jar to /home/work/repository/maven/com/carrotgarden/maven/flatten-maven-plugin-test-1/0.20171204203052/flatten-maven-plugin-test-1-0.20171204203052.jar
    [INFO] [INFO] Installing /home/work/source/git/flatten-maven-plugin/target/it/test-1/pom.xml.flatten to /home/work/repository/maven/com/carrotgarden/maven/flatten-maven-plugin-test-1/0.20171204203052/flatten-maven-plugin-test-1-0.20171204203052.pom
    [INFO] [INFO] 

    make sure flatten:flatten (by default bound to phase=package) is in fact before phase=install

tribbloid commented 6 years ago

I didn't see in test-1, did you mean test-2? Also, How do I run the test? And, it helps guiding other contributors if you add demos into unit/integration tests.

Andrei-Pozolotin commented 6 years ago

added:

https://github.com/random-maven/flatten-maven-plugin#plugin-demo

https://github.com/random-maven/flatten-maven-plugin#build-yourself

tribbloid commented 6 years ago

Also, I'm sorry I wasn't very specific about how maven-install-plugin malfunctions in this case:

It will select the right jar artifact and generate the right project pom file, but install into the wrong location, e.g. in your test-2 it will likely install into:

.m2/repository/com/carrotgarden/a/carrot-a/0-SNAPSHOT

instead of the correct:

.m2/repository/com/carrotgarden/a/carrot-a_2.12/0-SNAPSHOT

Andrei-Pozolotin commented 6 years ago

got it, will take a look

Andrei-Pozolotin commented 6 years ago

here is the fix https://github.com/random-maven/flatten-maven-plugin/commit/b1a06d8209449c2c6821e452a3e90bf2d0c78539

try fresh v 1.2.x https://bintray.com/random-maven/maven/flatten-maven-plugin

tribbloid commented 6 years ago

just tried locally:

maven-install is fixed, but now attach-sources and attach-javadoc are broken:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-source-plugin:2.4:jar (attach-sources) on project spookystuff-mldsl_2.10: Execution attach-sources of goal org.apache.maven.plugins:maven-source-plugin:2.4:jar failed.: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-source-plugin:2.4:jar (attach-sources) on project spookystuff-mldsl_2.10: Execution attach-sources of goal org.apache.maven.plugins:maven-source-plugin:2.4:jar failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:993)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:345)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:191)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution attach-sources of goal org.apache.maven.plugins:maven-source-plugin:2.4:jar failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:993)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:345)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:191)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: java.lang.NullPointerException
    at org.apache.maven.project.artifact.AttachedArtifact.getVersion (AttachedArtifact.java:138)
    at org.apache.maven.artifact.DefaultArtifact.validateIdentity (DefaultArtifact.java:148)
    at org.apache.maven.artifact.DefaultArtifact.<init> (DefaultArtifact.java:123)
    at org.apache.maven.project.artifact.AttachedArtifact.<init> (AttachedArtifact.java:49)
    at org.apache.maven.project.DefaultMavenProjectHelper.attachArtifact (DefaultMavenProjectHelper.java:60)
    at org.apache.maven.plugin.source.AbstractSourceJarMojo.packageSources (AbstractSourceJarMojo.java:316)
    at org.apache.maven.plugin.source.AbstractSourceJarMojo.packageSources (AbstractSourceJarMojo.java:247)
    at org.apache.maven.plugin.source.AbstractSourceJarMojo.execute (AbstractSourceJarMojo.java:216)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:993)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:345)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:191)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
[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

I speculate that it was caused by 'defaultPhase = LifecyclePhase.PREPARE_PACKAGE', probably there is a reason mojohaus version use 'GENERATE_RESOURCES'.

tribbloid commented 6 years ago

Also, would you mind adding (or adapting) the old integration test of mojohaus version that use assertions? This is to ensure backward compatibility, its too easy to make mistake on java open source project.

Andrei-Pozolotin commented 6 years ago

ok: another fix https://github.com/random-maven/flatten-maven-plugin/commit/b88cbe635d0d76d195f8a7a2324597b627ae3402#diff-5ec98d8e02ab5ef60a25cb00167e5de4 another try https://bintray.com/random-maven/maven/flatten-maven-plugin/1.2.20171205085950

integration test: yes, later

Andrei-Pozolotin commented 6 years ago

here is performOverrideIdentity test https://github.com/random-maven/flatten-maven-plugin/blob/master/src/it/test-2/verify.groovy

tribbloid commented 6 years ago

@Andrei-Pozolotin Looks all good! Though my project probably doesn't use enough third-party plugins to be objective enough. You may need other people to test all edge cases. Highly recommended to publish to maven central ASAP.

Andrei-Pozolotin commented 6 years ago

released http://repo1.maven.org/maven2/com/carrotgarden/maven/flatten-maven-plugin/

tribbloid commented 6 years ago

Just found one small problem: it will mess with reactor build order. This is really hard to fix and probably doesn't worth the effort.

Andrei-Pozolotin commented 6 years ago

you mean: override identity?

Andrei-Pozolotin commented 6 years ago

you can impose order via modules and depend on explicit scala identity: https://github.com/random-maven/flatten-maven-plugin/tree/master/src/it/test-3

tribbloid commented 6 years ago

Not if part of the submodules are optional through profile. Reactor build sequence was created for this case.

Andrei-Pozolotin commented 6 years ago

please close this if release is success

tribbloid commented 6 years ago

Oh, sure, sorry about that :)