You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Mathieu DREANO (JIRA)" <ji...@apache.org> on 2019/03/22 14:24:00 UTC

[jira] [Comment Edited] (MJDEPS-3) Can't handle long classpath

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

Mathieu DREANO edited comment on MJDEPS-3 at 3/22/19 2:23 PM:
--------------------------------------------------------------

Hello [~rfscholte],

I modified the plugin to use ProcessBuilder API instead of plexus-util. ([https://stackoverflow.com/questions/55123717/shorten-classpath-cp-for-command-line])
 It seems to solves the problem.
 But I don't really understand how to handle the results (I commented everything in executeJDepsCommandLine method)
{code:java}
private void executeWithProcessBuilderAPI( final Commandline cmd ) throws MojoExecutionException
{
    System.out.println( "START: execute command Line with ProcessBuilder" );
    ProcessBuilder processBuilder = new ProcessBuilder( cmd.getCommandline() );
    try
    {
        final Process process = processBuilder.start();
    }
    catch ( IOException e )
    {
        e.printStackTrace();
        throw new MojoExecutionException( e.getMessage() );
    }
    System.out.println( "END: execute command Line with ProcessBuilder" );

}
{code}


was (Author: mathieudreano):
Hello [~rfscholte],

I modified the plugin to use ProcessBuilder API instead of plexus-util. (https://stackoverflow.com/questions/55123717/shorten-classpath-cp-for-command-line)
It seems to solves the problem.
But I don't really understand how to handle the results (I commented everything in executeJDepsCommandLine method)
{code:java}
private void executeWithProcessBuilderAPI( final Commandline cmd ) throws MojoExecutionException
{
    System.out.println( "START: execute command Line with ProcessBuilder" );
    getLog().info( "Executing: " + CommandLineUtils.toString( cmd.getCommandline() ).replaceAll( "'", "" ) );
    ProcessBuilder processBuilder = new ProcessBuilder( cmd.getCommandline() );
    try
    {
        final Process process = processBuilder.start();
        System.out.println( "process started" );
        File log = new File( getProject().getBasedir(), "jdeps.log" );
        processBuilder.redirectErrorStream( true );
        processBuilder.redirectOutput( Redirect.appendTo( log ) );

        process.getInputStream();
        String finalString = new String( process.getInputStream().readAllBytes() );
        System.out.println( finalString );
        System.out.println( "process ended" );
    }
    catch ( IOException e )
    {
        e.printStackTrace();
        throw new MojoExecutionException( e.getMessage() );
    }
    System.out.println( "END: execute command Line with ProcessBuilder" );

}
{code}

> Can't handle long classpath
> ---------------------------
>
>                 Key: MJDEPS-3
>                 URL: https://issues.apache.org/jira/browse/MJDEPS-3
>             Project: Maven JDeps Plugin
>          Issue Type: Bug
>         Environment: Java version: 1.8.0_131, vendor: Oracle Corporation
> Java home: C:\java\jdk8\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
>            Reporter: Clas Forsberg
>            Priority: Critical
>         Attachments: error.txt
>
>
> When running  I got this error
> Cannot run program "C:\java\jdk8\jre\..\bin\jdeps.exe": CreateProcess error=206, The filename or extension is too long
> Mavan debug log attached



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