takari / polyglot-maven

Support alternative markup for Apache Maven POM files
Eclipse Public License 1.0
893 stars 101 forks source link

Getting "Input contained no data" on Maven 3.6.2 #200

Closed thorntonrp closed 4 years ago

thorntonrp commented 5 years ago

After upgrading to Maven 3.6.2, all my builds that use polyglot-maven get an error like the following:

[FATAL] Non-readable POM /.../.polyglot.pom.kt: input contained no data @ 

To determine whether this was language-specific I've translated a pom.xml to ruby, groovy, and kotlin, and all of of them get the same error on Maven 3.6.2: "input contained no data".

I suspect this may be a bug in Maven due to the nature of the changes described in the release notes, but in my testing I've so far been unable to determine the exact cause of the failure.

I upgraded my cloned copy of polyglot-maven to Maven 3.6.2 and tests that were previously passing are now failing due to an inability to find some required components, but that might be a separate issue.

qoomon commented 5 years ago

It seems to be related with the switch from plexus to guice. https://github.com/apache/maven/commit/353d3eaa8f2be47878f584a7da398572b41d90af

headius commented 5 years ago

Also getting this error building JRuby (using polyglot-maven).

[] ~/projects/jruby $ mvn
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-readable POM /Users/headius/projects/jruby/.polyglot.pom.rb: input contained no data @ 
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project  (/Users/headius/projects/jruby/.polyglot.pom.rb) has 1 error
[ERROR]     Non-readable POM /Users/headius/projects/jruby/.polyglot.pom.rb: input contained no data
[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/ProjectBuildingException
headius commented 5 years ago

This could be related...perhaps IntelliJ has pulled in the latest Maven?

https://youtrack.jetbrains.com/issue/IDEA-223567

This prevents me from opening the JRuby project in IDEA.

mosabua commented 5 years ago

I have not had a chance to investigate but I can confirm that things are busted with 3.6.2

headius commented 5 years ago

Still broken and we are getting reports from users and contributors that can't build JRuby now.

headius commented 5 years ago

I filed a Maven issue to try to move this along: https://issues.apache.org/jira/browse/MNG-6788

daemonblade commented 5 years ago

It has already been logged at https://issues.apache.org/jira/browse/MNG-6765

mosabua commented 5 years ago

If we have to update polyglot to work with 3.6.2 we can imho do that. From what I know most polyglot users are using latest maven and we could just do a version upgrade and require 3.6.2+ for the new release. Just dont know if that is feasible for a change in polyglot of if Maven needs to be fixed.

jvanzyl commented 5 years ago

I’ll take a look tomorrow.

qoomon commented 5 years ago

I solved this issue for my own extension by replacing org.apache.maven.model.building. DefaultModelProcessor, it is a little hacky, however it makes the extension working again.

see https://github.com/qoomon/maven-git-versioning-extension/commit/0f649b951294bde8eecf8c391d75fddb3aaf0ad4

jvanzyl commented 5 years ago

I tried fixing this, and Stuart did something similar but I was able to confirm that JRuby builds work with these changes:


bash-3.2$ mvn clean compile
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] gem with jar                                                       [gem]
[INFO] ruby                                                               [pom]
[INFO] server                                                             [jar]
[INFO] hello                                                              [jar]
[INFO] 
[INFO] --------------------------< rubygems:example >--------------------------
[INFO] Building gem with jar 2                                            [1/4]
[INFO] --------------------------------[ gem ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.4:clean (default-clean) @ example ---
[INFO] Deleting /Users/jvanzyl/js/maven/polyglot-maven-examples/ruby/example/pkg
[INFO] 
[INFO] --- gem-maven-plugin:1.1.5:initialize (default-initialize) @ example ---
[INFO] 
[INFO] if you want to use the executable lock_jars then install ruby-maven gem before using lock_jars
[INFO] 
[INFO]   $ gem install ruby-maven -v '~> 3.3.11'
[INFO] 
[INFO] or add it as a development dependency to your Gemfile
[INFO] 
[INFO]    gem 'ruby-maven', '~> 3.3.11'
[INFO] 
[INFO] Successfully installed jar-dependencies-0.3.12
[INFO] 1 gem installed
[INFO] Successfully installed rspec-2.14.1
[INFO] Successfully installed rspec-core-2.14.8
[INFO] Successfully installed rspec-expectations-2.14.5
[INFO] Successfully installed diff-lcs-1.3
[INFO] Successfully installed rspec-mocks-2.14.6
[INFO] Successfully installed rake-10.3.2
[INFO] 6 gems installed
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/jvanzyl/js/maven/polyglot-maven-examples/ruby/example/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ example ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /Users/jvanzyl/js/maven/polyglot-maven-examples/ruby/example/pkg/classes
[INFO] 
[INFO] -------------------------< com.example:parent >-------------------------
[INFO] Building ruby 1                                                    [2/4]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ parent ---
[INFO] 
[INFO] ----------------------< no_group_id_given:server >----------------------
[INFO] Building server 0.0.0                                              [3/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ server ---
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ server ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/jvanzyl/js/maven/polyglot-maven-examples/ruby/server/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ server ---
[INFO] No sources to compile
[INFO] 
[INFO] ----------------------< no_group_id_given:hello >-----------------------
[INFO] Building hello 0.0.0                                               [4/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ hello ---
[INFO] 
[INFO] --- polyglot-maven-plugin:0.4.4-SNAPSHOT:execute (hello) @ hello ---
hello world
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hello ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/jvanzyl/js/maven/polyglot-maven-examples/ruby/hello/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ hello ---
[INFO] No sources to compile
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] gem with jar 2 ..................................... SUCCESS [ 12.118 s]
[INFO] ruby 1 ............................................. SUCCESS [  0.018 s]
[INFO] server 0.0.0 ....................................... SUCCESS [  0.122 s]
[INFO] hello 0.0.0 ........................................ SUCCESS [  0.030 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  14.630 s
[INFO] Finished at: 2019-10-18T13:06:54-04:00
[INFO] ------------------------------------------------------------------------```

So I assume they will make a release soon to fix this.

Jason
mosabua commented 5 years ago

are you saying this is with current snapshot of Maven @jvanzyl so 3.6.3 will be okay again?

jvanzyl commented 5 years ago

What I see building on their branch is the same change I made, so when that change lands it will work.

jvanzyl commented 5 years ago

The change is here, it should land on master soon:

https://gitbox.apache.org/repos/asf?p=maven.git;a=blob;f=maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProcessor.java;h=e4c7dd855b9da7539382f2ffba8e17c94568d1b7;hb=53a70bc8543124569ee787725b2004bc92a681b6

I suggested a small change to match the naming I have which I think is more clear. @Named( "core" ) should be @Named( "allowDefaultOverride" )

mosabua commented 5 years ago

This will be fixed in the upcoming 3.6.3 release of Maven. Until then please just avoid using 3.6.2

mosabua commented 5 years ago

3.6.3 is currently staged and I have tested polyglot-maven, polyglot-maven-examples and a bunch of other projects. All good. Once that release is out you should be able to update to latest release again..

mosabua commented 4 years ago

Project is updated to use 3.6.3 with maven wrapper and that works now.