Willem, I am really gratefull for you help.

But to achieve my goal I believe that must be  little camel trick to figure
out in the -Dversion=1.0-SNAPSHOT arg.  I will explain:

my purpose is to create a maven project as described by my processor below
(I decided set the header in a processor rather in spring dsl)




This is my processor:


package br.edu.fzlbpms.template.camel.batch.impl;

import java.util.ArrayList;
import java.util.List;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;

public class SetExecCommandAndArgsProcessor implements Processor{


        public void process(Exchange exchange ) throws Exception {
        
                
                String command = (String)exchange.getIn().getHeader("command"); 
        
                System.out.println(command);
                
                String bOfBatch = "-B";
                System.out.println(bOfBatch);
                
                String DinteractiveMode = "false";
                System.out.println(DinteractiveMode);
                
                String archetype_and_goal =
(String)exchange.getIn().getHeader("archetype_and_goal");
                System.out.println(archetype_and_goal);         
                
                String DarchetypeGroupId =
(String)exchange.getIn().getHeader("DarchetypeGroupId");
                System.out.println(DarchetypeGroupId);
                
                String DarchetypeArtifactId =
(String)exchange.getIn().getHeader("DarchetypeArtifactId");
                System.out.println(DarchetypeArtifactId);
                
                String Dversion = 
(String)exchange.getIn().getHeader("Dversion");
                System.out.println(Dversion);
                
                String DgroupId = 
(String)exchange.getIn().getHeader("DgroupId");
                System.out.println(DgroupId);
                
                String DartifactId = 
(String)exchange.getIn().getHeader("DartifactId");
                System.out.println(DartifactId);
                

                
                
                List<String> listArgs = new ArrayList<String>();
                listArgs.add(bOfBatch);
                listArgs.add(archetype_and_goal);
                listArgs.add("-DarchetypeGroupId="+DarchetypeGroupId);
                listArgs.add("-DarchetypeArtifactId="+DarchetypeArtifactId);
                listArgs.add("-Dversion="+Dversion);
                listArgs.add("-DgroupId="+DgroupId);
                listArgs.add("-DartifactId="+DartifactId);
                listArgs.add("-DinteractiveMode="+DinteractiveMode);
                
                  
                
        
exchange.getOut().setHeader("CamelExecCommandWorkingDir","/run/media/wagner/fzlbpms_env/PROGSATIVOS/fzlbpms/workdirs");
         
                exchange.getOut().setHeader("CamelExecCommandExecutable", 
command);     
                exchange.getOut().setHeader("CamelExecCommandArgs", listArgs);
                
                
        }
}




In fact the headers are working very well. I think that the problem is about
the -Dversion=1.0-SNAPSHOT because issuing the folowing url in the browser 

http://localhost:8891/jetty_batch?*command=mvn*&*b=b*&*archetype_and_goal=archetype:generate*&*DarchetypeGroupId=br.edu.fzlbmps.template*&*DarchetypeArtifactId=fzlbpms_process_parent_template-archetype*&*Dversion=1.0-SNAPSHOT*&*DgroupId=com.br.nome_empresa.processos*&*DartifactId=nome_empresa_processo_helloworld*


I am receiving (in the browser) the folowing output that show problems with
version parameter:


[INFO] Scanning for projects...
[INFO]                                                                         
[INFO]
------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO]
------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @
standalone-pom >>>
[INFO] 
[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @
standalone-pom <<<
[INFO] 
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @
standalone-pom ---
[INFO] Generating project in Batch mode
[WARNING] Specified archetype not found.
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 4.053s
[INFO] Finished at: Thu Nov 01 22:23:22 BRST 2012
[INFO] Final Memory: 8M/80M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli)
on project standalone-pom: *The desired archetype does not exist
(br.edu.fzlbmps.template:fzlbpms_process_parent_template-archetype:1.0) *->
[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/MojoFailureException



In fact, the archetype

(br.edu.fzlbmps.template:fzlbpms_process_parent_template-archetype:*1.0*)
should be

(br.edu.fzlbmps.template:fzlbpms_process_parent_template-archetype:*1.0-SNAPSHOT*)
to be find properly by command.




The camel are receiving the version parameter correctly because my message
inspector print the CamelExecCommandArgs header as below:

headerKey = CamelExecCommandArgs

headerValue = [-B, archetype:generate,
-DarchetypeGroupId=br.edu.fzlbmps.template,
-DarchetypeArtifactId=fzlbpms_process_parent_template-archetype,
*-Dversion=1.0-SNAPSHOT*, -DgroupId=com.br.nome_empresa.processos,
-DartifactId=nome_empresa_processo_helloworld, -DinteractiveMode=false]


So my guess is that, when came issue the composed command maybe there are a
problem to deal with the dash caracter of version parameter, but its just a
guess.


Could you help me a little more? My thanks to this forum will be present in
my undergraduate term paper thanks session :)



best regards












--
View this message in context: 
http://servicemix.396122.n5.nabble.com/How-to-set-camel-exec-command-dinamically-tp5714807p5714819.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to