On 8 Jun 07, at 5:02 PM 8 Jun 07, Mick Knutson wrote:

Well, I added the source to ./target/generated-sources/*


Look at the example I showed you. This will not work and is not recommended. Your plugin that generates the sources must use the reference of the MavenProject and add the resources and sources programmatically. You do not want to make everyone using your plugin have to configure this. Look at the Antlr plugin, which is the way you should be doing it.

With adding the <includes> to my compiler like this:

           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-compiler-plugin</artifactId>
               <configuration>
                   <compilerVersion>1.5</compilerVersion>
                   <source>1.5</source>
                   <target>1.5</target>
                   <debug>${compiler.debug}</debug>
<showDeprecation>${showDeprecation}</ showDeprecation>
                   <showWarnings>${showWarnings}</showWarnings>
                   <optimize>${optimize}</optimize>

                   <meminitial>${meminitial}</meminitial>
                   <maxmem>${maxmem}</maxmem>

                   <includes>
                       <include>${basedir}/src/main/java</include>
                       <include>${basedir}/src/test/java</include>

<include>${basedir}/target/generated-sources</include>
                   </includes>

               </configuration>
           </plugin>




I start getting test compilation errors.




On 6/8/07, Jason van Zyl <[EMAIL PROTECTED]> wrote:


On 8 Jun 07, at 4:27 PM 8 Jun 07, Mick Knutson wrote:

> I have java and xml files being generated and I want to know where
> to put
> them in order for them to be compiled and included into my war?
>

It's not where you put, but telling Maven there are new sources and
new resources:

From the Antlr plugin:

       if ( project != null )
         {
             // Add resources
             projectHelper.addResource( project,
outputDirectory.getAbsolutePath(), Collections
                 .singletonList( "**/**.txt" ), new ArrayList() );

             // Add source root
project.addCompileSourceRoot ( outputDirectory.getAbsolutePath()
);
         }

Reference: http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-
antlr-plugin/src/main/java/org/apache/maven/plugin/antlr/
AbstractAntlrMojo.java

Typically you put generated sources in ${project.build.directory}/
generated-sources/<short-plugin-id>

So for the Antlr plugin this is target/generated-sources/antlr


> --
> ---
> Thanks,
> Mick Knutson
>
> http://www.baselogic.com
> http://www.blincmagazine.com
> http://www.djmick.com
> http://www.myspace.com/mickknutson
> http://www.myspace.com/djmick_dot_com
> http://www.myspace.com/sexybeotches
> http://www.thumpradio.com
> ---

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder and PMC Chair, Apache Maven
jason at sonatype dot com
----------------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
---
Thanks,
Mick Knutson

http://www.baselogic.com
http://www.blincmagazine.com
http://www.djmick.com
http://www.myspace.com/mickknutson
http://www.myspace.com/djmick_dot_com
http://www.myspace.com/sexybeotches
http://www.thumpradio.com
---

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder and PMC Chair, Apache Maven
jason at sonatype dot com
----------------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to