[ 
https://issues.apache.org/jira/browse/MNG-6358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16364905#comment-16364905
 ] 

Adam John Burley commented on MNG-6358:
---------------------------------------

Hi <[~gboue]>,

Thanks for the pointer. I also figured this out myself in the last 24 hours, 
and, at least for the purpose of my (non-Internet-facing) build, wrote some 
extra lines in that file to get it to build. You can find what I did here: 
https://stackoverflow.com/a/48797028/191761 - ideally this should be a toggle 
within the Maven build for situations like these.

By the way, as you yourself alluded to, some of the licenses don't download 
directly as currently configured, and probably another fix is required for 
those (I guess another JIRA issue should be raised). These are:
* https://glassfish.java.net/public/CDDLv1.0.html downloads as a 0KB file (see 
"jsr250-api.license" in the distribution). A backup is here: 
https://forgerock.org/license/CDDLv1.0.html
* http://www.opensource.org/licenses/mit-license.php currently downloads just 
an HTML file containing a 301 redirect (see e.g. "slf4j-api.license" in the 
distribution). This is because the actual call is redirecting to 
https://opensource.org/licenses/mit-license.php - which is what the Maven build 
should actually be downloading

There is a precedent here in terms of lines 32-35 in LICENSE.vm (which you 
linked to) rewriting the URL "glassfish.dev.java.net" to "glassfish.java.net". 
So something similar needs to be done for the above two bullet points.

> Maven build should not require access to apache.org
> ---------------------------------------------------
>
>                 Key: MNG-6358
>                 URL: https://issues.apache.org/jira/browse/MNG-6358
>             Project: Maven
>          Issue Type: Bug
>          Components: Bootstrap &amp; Build
>    Affects Versions: 3.5.2
>         Environment: RHEL 7.4
> JDK 1.8.0_141
>            Reporter: Adam John Burley
>            Priority: Minor
>
> I am trying to build Maven 3.5.2 from source using Maven 3.0.5. The machine I 
> am building on has access to an internal Maven repository, but doesn't have 
> access to the Internet.
> The build fails, seemingly because it cannot access {{apache.org}} to 
> download the license. But I don't understand why it needs to do this, as the 
> license is already contained in file {{apache-jar-resource-bundle}} which is 
> retrieved as a Maven dependency.
> Here is the log I get:
> {code}
> [INFO] --- apache-rat-plugin:0.11:check (rat-check) @ apache-maven ---
> [INFO] 51 implicit excludes (use -debug for more details).
> [INFO] Exclude: src/test/resources*/**
> [INFO] Exclude: src/test/projects/**
> [INFO] Exclude: src/test/remote-repo/**
> [INFO] Exclude: **/*.odg
> [INFO] Exclude: src/bin/m2.conf
> [INFO] Exclude: bootstrap/**
> [INFO] Exclude: README.bootstrap.txt
> [INFO] Exclude: .repository/**
> [INFO] Exclude: .maven/spy.log
> [INFO] Exclude: .java-version
> [INFO] Exclude: README.md
> [INFO] Exclude: DEPENDENCIES
> [INFO] 19 resources included (use -debug for more details)
> [INFO] Rat check: Summary of files. Unapproved: 0 unknown: 0 generated: 0 
> approved: 16 licence.
> [INFO] 
> [INFO] --- maven-dependency-plugin:2.8:unpack-dependencies 
> (unpack-jansi-native) @ apache-maven ---
> [INFO] Unpacking 
> /root/.m2/repository/org/fusesource/jansi/jansi/1.16/jansi-1.16.jar to 
> /tmp/maven-build/apache-maven/target/dependency with includes 
> "META-INF/native/**" and excludes ""
> [INFO] 
> [INFO] --- maven-remote-resources-plugin:1.5:process (default) @ apache-maven 
> ---
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Reactor Summary:
> [INFO] 
> [INFO] Apache Maven ...................................... SUCCESS [25.091s]
> [INFO] Maven Model ....................................... SUCCESS [18.000s]
> [INFO] Maven Artifact .................................... SUCCESS [4.418s]
> [INFO] Maven Plugin API .................................. SUCCESS [4.677s]
> [INFO] Maven Builder Support ............................. SUCCESS [1.900s]
> [INFO] Maven Model Builder ............................... SUCCESS [5.690s]
> [INFO] Maven Settings .................................... SUCCESS [1.905s]
> [INFO] Maven Settings Builder ............................ SUCCESS [2.010s]
> [INFO] Maven Repository Metadata Model ................... SUCCESS [1.511s]
> [INFO] Maven Artifact Resolver Provider .................. SUCCESS [5.110s]
> [INFO] Maven Core ........................................ SUCCESS [13.168s]
> [INFO] Maven SLF4J Simple Provider ....................... SUCCESS [5.013s]
> [INFO] Maven Embedder .................................... SUCCESS [3.617s]
> [INFO] Maven Compat ...................................... SUCCESS [4.462s]
> [INFO] Apache Maven Distribution ......................... FAILURE [4:18.467s]
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 5:58.134s
> [INFO] Finished at: Mon Feb 12 21:03:11 GMT 2018
> [INFO] Final Memory: 83M/190M
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process (default) 
> on project apache-maven: Error rendering velocity resource. Invocation of 
> method 'getResourceAsFile' in  class 
> org.codehaus.plexus.resource.DefaultResourceManager threw exception 
> org.codehaus.plexus.resource.loader.ResourceNotFoundException: Could not find 
> resource 'https://www.apache.org/licenses/LICENSE-2.0.txt'. at 
> remote-resources[line 38, column 26] -> [Help 1]
> [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/MojoExecutionException
> [ERROR] 
> [ERROR] After correcting the problems, you can resume the build with the 
> command
> [ERROR]   mvn <goals> -rf :apache-maven
> {code}
> And the stacktrace:
> {code}
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process (default) 
> on project apache-maven: Error rendering velocity resource. Invocation of 
> method 'getResourceAsFile' in  class 
> org.codehaus.plexus.resource.DefaultResourceManager threw exception 
> org.codehaus.plexus.resource.loader.ResourceNotFoundException: Could not find 
> resource 'https://www.apache.org/licenses/LICENSE-2.0.txt'. at 
> remote-resources[line 38, column 26] -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute 
> goal org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process 
> (default) on project apache-maven: Error rendering velocity resource.
>     at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
>     at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>     at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>     at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>     at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>     at 
> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>     at 
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
>     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
>     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>     at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
>     at java.lang.reflect.Method.invoke(Method.java:508)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:414)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Error rendering 
> velocity resource.
>     at 
> org.apache.maven.plugin.resources.remote.ProcessRemoteResourcesMojo.processResourceBundles(ProcessRemoteResourcesMojo.java:1246)
>     at 
> org.apache.maven.plugin.resources.remote.ProcessRemoteResourcesMojo.execute(ProcessRemoteResourcesMojo.java:520)
>     at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>     at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>     ... 19 more
> Caused by: org.apache.velocity.exception.MethodInvocationException: 
> Invocation of method 'getResourceAsFile' in  class 
> org.codehaus.plexus.resource.DefaultResourceManager threw exception 
> org.codehaus.plexus.resource.loader.ResourceNotFoundException: Could not find 
> resource 'https://www.apache.org/licenses/LICENSE-2.0.txt'. at 
> remote-resources[line 38, column 26]
>     at 
> org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:243)
>     at 
> org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:187)
>     at 
> org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280)
>     at 
> org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:567)
>     at 
> org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
>     at 
> org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142)
>     at 
> org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
>     at 
> org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
>     at 
> org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
>     at 
> org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
>     at 
> org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
>     at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:420)
>     at 
> org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
>     at 
> org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
>     at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:420)
>     at 
> org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
>     at 
> org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
>     at 
> org.apache.velocity.runtime.RuntimeInstance.render(RuntimeInstance.java:1378)
>     at 
> org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1314)
>     at org.apache.velocity.app.Velocity.evaluate(Velocity.java:254)
>     at 
> org.apache.maven.plugin.resources.remote.ProcessRemoteResourcesMojo.processResourceBundles(ProcessRemoteResourcesMojo.java:1218)
>     ... 22 more
> Caused by: org.codehaus.plexus.resource.loader.ResourceNotFoundException: 
> Could not find resource 'https://www.apache.org/licenses/LICENSE-2.0.txt'.
>     at 
> org.codehaus.plexus.resource.DefaultResourceManager.getResource(DefaultResourceManager.java:173)
>     at 
> org.codehaus.plexus.resource.DefaultResourceManager.getResourceAsFile(DefaultResourceManager.java:91)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
>     at java.lang.reflect.Method.invoke(Method.java:508)
>     at 
> org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395)
>     at 
> org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384)
>     at 
> org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173)
>     ... 41 more
> {code}
> The error seems to be caused by Apache Velocity invoking a method to retrieve 
> the file via reflection. But I am not sure why this is, because I can't find 
> any Velocity templates with this reflective method call inside.
> Incidentally, if I disable the plugin using "-Dremoteresources.skip=true", 
> the build succeeds. So it's definitely something caused by the way this 
> plugin is configured.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to