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

qulice-maven-plugin 0.8: Build failure with URISyntaxException #243

Closed
carlosmiranda opened this issue May 6, 2014 · 11 comments
Closed
Labels

Comments

@carlosmiranda
Copy link
Contributor

See log below. It may be a Windows-specific bug since it complains about the path URI, though I'm not sure. This does not happen when I revert the build to version 0.5.1.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:15.539s
[INFO] Finished at: Tue May 06 09:19:26 SGT 2014
[INFO] Final Memory: 27M/64M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.qulice:qulice-maven-plugin:0.8:check (jcabi-check) on project jcabi-http: Execution jcabi-check of goal com.qulice:qulice-maven-plugin:0.8:check failed: Illegal character in authority at index 7: file://C:\Users\Carlos Miranda\git\jcabi-http\target\classes -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.qulice:qulice-maven-plugin:0.8:check (jcabi-check) on project jcabi-http: Execution jcabi-check of goal com.qulice:qulice-maven-plugin:0.8:check failed: Illegal character in authority at index 7: file://C:\Users\Carlos Miranda\git\jcabi-http\target\classes
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
        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:317)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        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)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution jcabi-check of goal com.qulice:qulice-maven-plugin:0.8:check failed: Illegal character in authority at index 7: file://C:\Users\Carlos Miranda\git\jcabi-http\target\classes
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:115)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 19 more
Caused by: java.lang.IllegalArgumentException: Illegal character in authority at index 7: file://C:\Users\Carlos Miranda\git\jcabi-http\target\classes
        at java.net.URI.create(URI.java:859)
        at com.qulice.maven.DefaultMavenEnvironment.classloader(DefaultMavenEnvironment.java:155)
        at com.qulice.checkstyle.CheckstyleValidator.validate(CheckstyleValidator.java:78)
        at com.qulice.maven.CheckMojo.run(CheckMojo.java:75)
        at com.qulice.maven.CheckMojo.doExecute(CheckMojo.java:59)
        at com.qulice.maven.AbstractQuliceMojo.execute(AbstractQuliceMojo.java:175)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
        ... 20 more
Caused by: java.net.URISyntaxException: Illegal character in authority at index 7: file://C:\Users\Carlos Miranda\git\jcabi-http\target\classes
        at java.net.URI$Parser.fail(URI.java:2829)
        at java.net.URI$Parser.parseAuthority(URI.java:3167)
        at java.net.URI$Parser.parseHierarchical(URI.java:3078)
        at java.net.URI$Parser.parse(URI.java:3034)
        at java.net.URI.<init>(URI.java:595)
        at java.net.URI.create(URI.java:857)
        ... 26 more
[ERROR]
[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
@carlosmiranda
Copy link
Contributor Author

Seems like the error exists in DefaultMavenEnvironment.classloader() method. It should have been fixed by #205 which is included in the 0.8 release, but for some reason it's actually broken when it wasn't before. Maybe we missed something.

Also see senny/emacs-eclim#115, which may be related.

@carlosmiranda
Copy link
Contributor Author

I was able to find the problem, it's with the DefaultMavenEnvironment.classpath() method:

public Collection<String> classpath() {
    final Collection<String> paths = new LinkedList<String>();
    try {
        for (final String name
            : this.iproject.getRuntimeClasspathElements()) {
            paths.add(name); // Bug! Did NOT replace file separator with '/'
        }
        for (final Artifact artifact
            : this.iproject.getDependencyArtifacts()) {
            paths.add(
                artifact.getFile().getAbsolutePath()
                    .replace(File.separatorChar, '/') // Correct, replaced file separator here
            );
        }
    } catch (final DependencyResolutionRequiredException ex) {
        throw new IllegalStateException("Failed to read classpath", ex);
    }
    return paths;
}

Ironically we originally replaced File with String in #205 in order to avoid file separator issues. However, File.toURI().toURL() in the old implementation already normalized the separators. In fact according to the Javadoc:

toURL()
Deprecated.
This method does not automatically escape characters that are illegal in URLs. It is recommended that new code convert an abstract pathname into a URL by first converting it into a URI, via the toURI method, and then converting the URI into a URL via the URI.toURL method.

In other words reverting #205 will fix this bug. However, the toURI() Javadoc also has the caveat that it is system dependent, so we should just replace the separators as I highlighted in the above code snippet.

We should fix it ASAP so that our team's Windows developers don't get blocked.

@yegor256 yegor256 added the bug label May 6, 2014
@davvd
Copy link

davvd commented May 6, 2014

I'm aware of the task, give me some time to find a developer...

@davvd
Copy link

davvd commented May 6, 2014

@carlosmiranda thanks for this report, I added 15 mins to your account, in transaction 39266321

@davvd
Copy link

davvd commented May 19, 2014

@longtimeago can you please help? Keep in mind this. If you have any technical questions, don't hesitate to ask right here

@davvd
Copy link

davvd commented May 19, 2014

@longtimeago This task's budget is 30 mins. This is exactly how much will be paid when the problem explained above is solved. See this for more information

@longtimeago
Copy link
Contributor

@yegor256 @davvd Fix #248 is ready for review

yegor256 pushed a commit that referenced this issue May 26, 2014
Issue #243 DefaultMavenEnvironment.classloader() hotfix
@longtimeago
Copy link
Contributor

@carlosmiranda Please, close the issue. Thank you!

@carlosmiranda
Copy link
Contributor Author

@longtimeago thanks! @yegor256 can we have a bugfix release for this?

@yegor256
Copy link
Owner

@carlosmiranda sure, version 0.8.2 released to Maven Central

@davvd
Copy link

davvd commented May 28, 2014

@longtimeago Thanks for your contribution, 30 mins was added to your account, payment ID is 40144603

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants