You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Roman Kournjaev <ko...@gmail.com> on 2009/03/25 10:26:32 UTC

Providing multiply source directories ..

Hi Folks ..

This one is supposed to be an easy one .

<build>
        <defaultGoal>install</defaultGoal>
        <directory>target</directory>
        <outputDirectory>target/classes</outputDirectory>
        <finalName>${project.artifactId}-${project.version}
        </finalName>
        <testOutputDirectory>target/test-classes
        </testOutputDirectory>
        <sourceDirectory>src/main/java</sourceDirectory>
        <scriptSourceDirectory>src/main/scripts
        </scriptSourceDirectory>
        <testSourceDirectory>src/test/java</testSourceDirectory>
</build>

Any idea how do i provide multiply source folders ?

I have some code also under src/main/java-gen ...

Thanks in advance.

Roman

Re: Providing multiply source directories ..

Posted by Jeff MAURY <je...@gmail.com>.
If your Maven plugin generate source files in a new folder then it is the
responsability of your Maven plugin to add this directories into the list of
source directories once the source have been generated (through the project
object that may be injected to your plugin by Maven).

Jeff MAURY

On Wed, Mar 25, 2009 at 10:49 AM, Roman Kournjaev <ko...@gmail.com>wrote:

> Thanks for the fast answer
>
> I do care about it and i want to do it the standart way.
>
> The sources i generate are created by my maven plugin, and i need them to
> be
> generated before compiling the project itself, since i refer to them from
> my
> code.
>
> I would like also to see the gen sources in eclipse , so i have just added
> the src/main/java-gen to the sources folders in eclipse.
>
> i think if i will put them in to target/genereated-sources eclipse will get
> nuts and wont recognize that i have them att all.
>
> Any idea how to do this the best way ?
>
> Thanks
>
> On Wed, Mar 25, 2009 at 11:41 AM, <Cl...@raibau.at> wrote:
>
> > The easy answer is the maven-helper-plugin:
> > http://mojo.codehaus.org/build-helper-maven-plugin/add-source-mojo.html.
> >
> > src/main/java-gen probably means that your sources are generated by
> > someone. If this someone is a Maven plugin, then it probably does the job
> > of adding the source directory to your POM (which may not be what you
> > want, but that is not point now). If you generate the sources using the
> > AntRun plugin, you can add *one* extra source directory.
> >
> > And if you care (this is a convention): generated sources are placed
> under
> > target/generated-sources, and never under src.
> >
> >
> > ______________________________________
> > Diese E-Mail kann vertrauliche und geschuetzte Informationen enthalten.
> > Wenn diese E-Mail nicht für Sie bestimmt ist, bitten wir Sie, uns
> > unverzueglich zu informieren und sie zu loeschen.
> >
> > This e-mail message may contain information, which is confidential and
> > protected. If you are not the intended recipient of this message, we ask
> you
> > to inform us immediately and delete the message afterwards.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>



-- 
La mélancolie c’est communiste
Tout le monde y a droit de temps en temps
La mélancolie n’est pas capitaliste
C’est même gratuit pour les perdants
La mélancolie c’est pacifiste
On ne lui rentre jamais dedans
La mélancolie oh tu sais ça existe
Elle se prend même avec des gants
La mélancolie c’est pour les syndicalistes
Il faut juste sa carte de permanent

Miossec (2006)

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.lastfm.fr/listen/user/jeffmaury/personal

Re: Re: Providing multiply source directories ..

Posted by Cl...@raibau.at.
Eclipse doesn't care about target/generated-sources being a source folder 
(as long as it is not also the output folder, but the output folder is 
usually target/classes). 
If, when you say that "the sources ... are created by my maven plugin", 
you mean that you wrote the maven plugin yourself, then your change your 
maven plugin so that it adds as many extra source directories as you want. 

And finally: mvn eclipse:eclipse can generate the eclipse project files 
for you, and it will include all source directories added/injected up to 
the phase "generate-sources".

______________________________________
Diese E-Mail kann vertrauliche und geschuetzte Informationen enthalten. Wenn diese E-Mail nicht für Sie bestimmt ist, bitten wir Sie, uns unverzueglich zu informieren und sie zu loeschen. 

This e-mail message may contain information, which is confidential and protected. If you are not the intended recipient of this message, we ask you to inform us immediately and delete the message afterwards.

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


Re: Providing multiply source directories ..

Posted by Roman Kournjaev <ko...@gmail.com>.
Thanks for the fast answer

I do care about it and i want to do it the standart way.

The sources i generate are created by my maven plugin, and i need them to be
generated before compiling the project itself, since i refer to them from my
code.

I would like also to see the gen sources in eclipse , so i have just added
the src/main/java-gen to the sources folders in eclipse.

i think if i will put them in to target/genereated-sources eclipse will get
nuts and wont recognize that i have them att all.

Any idea how to do this the best way ?

Thanks

On Wed, Mar 25, 2009 at 11:41 AM, <Cl...@raibau.at> wrote:

> The easy answer is the maven-helper-plugin:
> http://mojo.codehaus.org/build-helper-maven-plugin/add-source-mojo.html.
>
> src/main/java-gen probably means that your sources are generated by
> someone. If this someone is a Maven plugin, then it probably does the job
> of adding the source directory to your POM (which may not be what you
> want, but that is not point now). If you generate the sources using the
> AntRun plugin, you can add *one* extra source directory.
>
> And if you care (this is a convention): generated sources are placed under
> target/generated-sources, and never under src.
>
>
> ______________________________________
> Diese E-Mail kann vertrauliche und geschuetzte Informationen enthalten.
> Wenn diese E-Mail nicht für Sie bestimmt ist, bitten wir Sie, uns
> unverzueglich zu informieren und sie zu loeschen.
>
> This e-mail message may contain information, which is confidential and
> protected. If you are not the intended recipient of this message, we ask you
> to inform us immediately and delete the message afterwards.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Providing multiply source directories ..

Posted by Cl...@raibau.at.
The easy answer is the maven-helper-plugin: 
http://mojo.codehaus.org/build-helper-maven-plugin/add-source-mojo.html.

src/main/java-gen probably means that your sources are generated by 
someone. If this someone is a Maven plugin, then it probably does the job 
of adding the source directory to your POM (which may not be what you 
want, but that is not point now). If you generate the sources using the 
AntRun plugin, you can add *one* extra source directory.

And if you care (this is a convention): generated sources are placed under 
target/generated-sources, and never under src.


______________________________________
Diese E-Mail kann vertrauliche und geschuetzte Informationen enthalten. Wenn diese E-Mail nicht für Sie bestimmt ist, bitten wir Sie, uns unverzueglich zu informieren und sie zu loeschen. 

This e-mail message may contain information, which is confidential and protected. If you are not the intended recipient of this message, we ask you to inform us immediately and delete the message afterwards.

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