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

Jose Barragan commented on FLEX-33290:
--------------------------------------

Hi Frédéric, 

I still in conversation about it with Chris, in fact this is the last email 
that I sent to him:

Hi Chris,

I got it, finally :)

I open this ticket in JIRA: FLEX-33290 - Apache Flex Mavenized SDK Deployer Bug 
and I've a patch that solve it,

It was the extra " in pom.getAbsolutePath, as far as I know, getAbsolutePath 
returns the absolute path fully escaped :) and by the way I did rewrote doPom 
method in ProcessBuilder way.
If you are in agreement with the change, I can publish it myself in repository.

SDKDeployer fix:
private void doPom(File pom) throws IOException, InterruptedException {
        File base = pom.getParentFile();
        final String fileName = pom.getName();
        String artifactName = fileName.substring(0, fileName.lastIndexOf("-"));

        if (artifactName != null) {
            final File artifacts[] = new File(pom.getParent()).listFiles(new 
ArtifactFilter());
                final List<String> processCmd = new ArrayList<String>(10);
                processCmd.add(mvn);
                processCmd.add("deploy:deploy-file");
                processCmd.add("-DrepositoryId=" + repositoryId);
                processCmd.add("-Durl=" + url);

                ProcessBuilder processBuilder = null;


            String packaging;
            String classifier = null;

            if (artifacts != null && artifacts.length > 0) {
                for (File artifact : artifacts) {
                    classifier = packaging = null;
                    artifactName = artifact.getName();

                    packaging = (artifactName.endsWith("rb.swc")) ? "rb.swc" : 
artifactName.substring(artifactName.lastIndexOf(".") + 1);

                    try {
                        classifier = artifactName
                                .substring(artifactName.indexOf(base.getName()) 
+ base.getName().length() + 1, artifactName.length() - packaging.length() - 1);
                    } catch (StringIndexOutOfBoundsException ex) {/*has no 
classifier*/}

                        processCmd.add("-Dfile=" + artifact.getAbsolutePath());
                        processCmd.add("-DpomFile=" + pom.getAbsolutePath());
                    if (classifier != null && classifier.length() > 0) {
                            processCmd.add("-Dclassifier=" + classifier);
                    }
                        processCmd.add("-Dpackaging=" + packaging);
                        processBuilder = new ProcessBuilder(processCmd);
                        exec(processBuilder.start());
                }
            } else {
                    processCmd.add("-Dfile=" + pom.getAbsolutePath());
                    processCmd.add("-DpomFile=" + pom.getAbsolutePath());
                    processBuilder = new ProcessBuilder(processCmd);
                    exec(processBuilder.start());
            }

        }
    }

    private void exec(Process p) throws InterruptedException, IOException {
        String line;
        BufferedReader bri = new BufferedReader(new 
InputStreamReader(p.getInputStream()));
        BufferedReader bre = new BufferedReader(new 
InputStreamReader(p.getErrorStream()));
        while ((line = bri.readLine()) != null) {
            System.out.println(line);
        }
        bri.close();
        while ((line = bre.readLine()) != null) {
            System.out.println(line);
        }
        bre.close();
        p.waitFor();
        System.out.println("Done.");
    }

Regards,

--
Jose Barragan
Software Architect Chief 
josebarra...@apache.org
                
> Apache Flex Mavenized SDK Deployer Bug
> --------------------------------------
>
>                 Key: FLEX-33290
>                 URL: https://issues.apache.org/jira/browse/FLEX-33290
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Installation & Packaging
>    Affects Versions: InstalApacheFlex 1.0
>            Reporter: Jose Barragan
>            Assignee: Frédéric THOMAS
>
> When use the SDKDeployer on MacOS, the maven subprocess fails with this error:
> /usr/share/maven/bin/mvn deploy:deploy-file -DrepositoryId=fdk-release 
> -Durl=http://maven.codeoscopic.com/content/repositories/fdk-release 
> -Dfile="/Users/pepebarragan/Desktop/fdk/com/adobe/air/framework/3.1/framework-3.1.pom"
>  
> -DpomFile="/Users/pepebarragan/Desktop/fdk/com/adobe/air/framework/3.1/framework-3.1.pom"
> [INFO] Scanning for projects...
> [INFO]                                                                        
>  
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Building flex-sdk-converter 1.0
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] 
> [INFO] --- maven-deploy-plugin:2.7:deploy-file (default-cli) @ 
> flex-sdk-converter ---
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 1.194s
> [INFO] Finished at: Mon Dec 10 14:57:55 CET 2012
> [INFO] Final Memory: 3M/81M
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on 
> project flex-sdk-converter: 
> /Users/pepebarragan/Developer/apache.org/flex/utilities/mavenizer/"/Users/pepebarragan/Desktop/fdk/com/adobe/air/framework/3.1/framework-3.1.pom
>  not found. -> [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
> Done.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to