You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Steffen Mazanek <ma...@steffen-mazanek.de> on 2007/03/12 20:12:27 UTC

Generate sources using program in same project

Hello,

our project consists of multiple subprojects. One subproject
implements a code generator, that takes an xml and generates
java.
Another subproject is called examples and consists of several
subprojects (basically just the xml-files for the generator).
How should I invoke the generator? How should the example
poms look like? In which subdirectories should they sit?
The code has to be generated and compiled.

I tried the maven exec plugin but I failed.

    <plugin>
     <groupId>org.codehaus.mojo</groupId>
     <artifactId>exec-maven-plugin</artifactId>
     <configuration>
      <mainClass>
       foo.Generator
      </mainClass>
      <keepAlive>true</keepAlive>
      <arguments>
       <argument>-c</argument>
       <argument>pathto\spec.xml</argument>
      </arguments>
     </configuration>
    </plugin>

I guess it failed because of a classpath problem. How can I track this?


Best regards,

Steffen

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Generate sources using program in same project

Posted by Manos Batsis <ma...@geekologue.com>.
For an example of maven-antrun-plugin used to generate sources see the 
ear and web module POMs of md4j-quickstarter [1]. MD4J [2] does not yet 
provide a maven plugin so the Ant task is used instead.

[1] http://md4j.cvs.sourceforge.net/md4j/md4j-quickstarter-mvn/
[2] geekologue.com/md4j/tutorial-with-maven.html

hth,

Manos


Armin Ehrenfels wrote:
> Hi Steffen,
> 
> one save and easy way is using maven-antrun-plugin. Here, you can think 
> ant. Look at http://maven.apache.org/plugins/maven-antrun-plugin  to 
> find out more on how to access maven's classpaths and more. One 
> particular problem I came across in this context with Java5:
> JDK-5.0 comes bundled with its own XML tools which are still buggy. I 
> couldn't find out how to turn off the bundled tools and use, for 
> example, the XALAN archive in maven's repository. Therefore, when using 
> XML tools , I run maven with JDK-1.4.
> 
> HTH
> 
> Armin
> 
> Steffen Mazanek wrote:
> 
>> Hello,
>>
>> our project consists of multiple subprojects. One subproject
>> implements a code generator, that takes an xml and generates
>> java.
>> Another subproject is called examples and consists of several
>> subprojects (basically just the xml-files for the generator).
>> How should I invoke the generator? How should the example
>> poms look like? In which subdirectories should they sit?
>> The code has to be generated and compiled.
>>
>> I tried the maven exec plugin but I failed.
>>
>>    <plugin>
>>     <groupId>org.codehaus.mojo</groupId>
>>     <artifactId>exec-maven-plugin</artifactId>
>>     <configuration>
>>      <mainClass>
>>       foo.Generator
>>      </mainClass>
>>      <keepAlive>true</keepAlive>
>>      <arguments>
>>       <argument>-c</argument>
>>       <argument>pathto\spec.xml</argument>
>>      </arguments>
>>     </configuration>
>>    </plugin>
>>
>> I guess it failed because of a classpath problem. How can I track this?
>>
>>
>> Best regards,
>>
>> Steffen
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Generate sources using program in same project

Posted by Armin Ehrenfels <Ar...@t-online.de>.
Hi Steffen,

one save and easy way is using maven-antrun-plugin. Here, you can think 
ant. Look at http://maven.apache.org/plugins/maven-antrun-plugin  to 
find out more on how to access maven's classpaths and more. One 
particular problem I came across in this context with Java5:
JDK-5.0 comes bundled with its own XML tools which are still buggy. I 
couldn't find out how to turn off the bundled tools and use, for 
example, the XALAN archive in maven's repository. Therefore, when using 
XML tools , I run maven with JDK-1.4.

HTH

Armin

Steffen Mazanek wrote:

> Hello,
>
> our project consists of multiple subprojects. One subproject
> implements a code generator, that takes an xml and generates
> java.
> Another subproject is called examples and consists of several
> subprojects (basically just the xml-files for the generator).
> How should I invoke the generator? How should the example
> poms look like? In which subdirectories should they sit?
> The code has to be generated and compiled.
>
> I tried the maven exec plugin but I failed.
>
>    <plugin>
>     <groupId>org.codehaus.mojo</groupId>
>     <artifactId>exec-maven-plugin</artifactId>
>     <configuration>
>      <mainClass>
>       foo.Generator
>      </mainClass>
>      <keepAlive>true</keepAlive>
>      <arguments>
>       <argument>-c</argument>
>       <argument>pathto\spec.xml</argument>
>      </arguments>
>     </configuration>
>    </plugin>
>
> I guess it failed because of a classpath problem. How can I track this?
>
>
> Best regards,
>
> Steffen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org