You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Eric Pugh <ep...@opensourceconnections.com> on 2004/10/19 16:48:40 UTC

[eclipse] Need to rethink using pom.build.resources in .classpath for Eclipse Plugin

Hi all,

A while ago some patches where made that allowed the <resources/> elements
to be added to the Eclipse .classpath.  This looked good, and I committed
it.  However, as I have gone on with more testing, I think this needs to be
reworked.

What happens is right now the resources for the regular java files and in
the <unitTest> section are duplicated...  This can lead to a situation where
you import the same path twice.  For example, in the below (trimmed)
section, I want to copy some resources always, and a log4j.properties when
running unit tests:

<build>
        <unitTest>
            <resources>
                <resource>
                    <directory>src/conf</directory>
                    <targetPath>/</targetPath>
                    <includes>
                        <include>test.avalonconf.xml</include>
                    </includes>
                    <filtering>false</filtering>
                </resource>
                <resource>
                    <includes>
                        <include>log4j.properties</include>
                    </includes>
                    <filtering>false</filtering>
                </resource>
            </resources>
        </unitTest>
        <resources>
            <resource>
                <directory>src/conf</directory>
                <targetPath>/</targetPath>
                <includes>
                    <include>hibernate.hbm.xml</include>
                    <include>ehcache.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>
    </build>

However, because they both go from src/conf to /, this causes two records to
be created in Eclipse.  I think, what needs to done is that a map of all the
possible sources needs to be made, and then we aggreagate together all the
changes.  However, this is a pretty big change, and I've not got the time
for it right now, but I'll be happy to help.

Also, we where not properly dealing with includes and excludes either..  I
added that.

Because this change can break things, I've added an extra check.  If
maven.eclipse.addResources=true in your project.properties, then the
existing logic will occur.  By default this is turned off so we don't start
breaking everybodies builds.

Eric Pugh





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


Re: [eclipse] Need to rethink using pom.build.resources in .classpath for Eclipse Plugin

Posted by Emmanuel Venisse <em...@venisse.net>.
Personnally, I think that duplicate resource declaration is a bad conception
of directory structure.
It isn't readable, and it's necessary to check the pom for know which file
go to which directory.

I'm -0 for rework the plugin for accept this bad conception.

Emmanuel

----- Original Message ----- 
From: "Eric Pugh" <ep...@opensourceconnections.com>
To: "Maven-Dev" <de...@maven.apache.org>
Sent: Tuesday, October 19, 2004 4:48 PM
Subject: [eclipse] Need to rethink using pom.build.resources in .classpath
for Eclipse Plugin


> Hi all,
>
> A while ago some patches where made that allowed the <resources/> elements
> to be added to the Eclipse .classpath.  This looked good, and I committed
> it.  However, as I have gone on with more testing, I think this needs to
be
> reworked.
>
> What happens is right now the resources for the regular java files and in
> the <unitTest> section are duplicated...  This can lead to a situation
where
> you import the same path twice.  For example, in the below (trimmed)
> section, I want to copy some resources always, and a log4j.properties when
> running unit tests:
>
> <build>
>         <unitTest>
>             <resources>
>                 <resource>
>                     <directory>src/conf</directory>
>                     <targetPath>/</targetPath>
>                     <includes>
>                         <include>test.avalonconf.xml</include>
>                     </includes>
>                     <filtering>false</filtering>
>                 </resource>
>                 <resource>
>                     <includes>
>                         <include>log4j.properties</include>
>                     </includes>
>                     <filtering>false</filtering>
>                 </resource>
>             </resources>
>         </unitTest>
>         <resources>
>             <resource>
>                 <directory>src/conf</directory>
>                 <targetPath>/</targetPath>
>                 <includes>
>                     <include>hibernate.hbm.xml</include>
>                     <include>ehcache.xml</include>
>                 </includes>
>                 <filtering>false</filtering>
>             </resource>
>         </resources>
>     </build>
>
> However, because they both go from src/conf to /, this causes two records
to
> be created in Eclipse.  I think, what needs to done is that a map of all
the
> possible sources needs to be made, and then we aggreagate together all the
> changes.  However, this is a pretty big change, and I've not got the time
> for it right now, but I'll be happy to help.
>
> Also, we where not properly dealing with includes and excludes either..  I
> added that.
>
> Because this change can break things, I've added an extra check.  If
> maven.eclipse.addResources=true in your project.properties, then the
> existing logic will occur.  By default this is turned off so we don't
start
> breaking everybodies builds.
>
> Eric Pugh
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>


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


RE: [eclipse] Need to rethink using pom.build.resources in .classpath for Eclipse Plugin

Posted by Eric Pugh <ep...@upstate.com>.
Well..  I think everybodies points are well said!  I learn something new
about doing project layout.  In retrospect, my setup is kinda boneheaded,
thats why I didn't see it when committing patches..  Only when I started
using it.  And instead of taking the simple approach of rationalizing my
layout, I started thinking about redesigning the plugin around it!

I will yank out the OFF switch!

Eric

> -----Original Message-----
> From: Fabrizio Giustina [mailto:fgiust@gmail.com]
> Sent: Tuesday, October 19, 2004 10:09 PM
> To: Maven Developers List
> Subject: Re: [eclipse] Need to rethink using pom.build.resources in
> .classpath for Eclipse Plugin
>
>
> I also think that having a single directory for both "standard" and
> "test" resources is pretty unusual and should be discouraged...
>
> a common project layout is usually something like:
> src/
>   main
>   resources
>   test
>   test-resources
>
> said that, I would like to see the include resource property ON by
> default also for the following considerations:
>
> - loosing source resources will break probably more builds than having
> resource folders added twice for projects with such unusual directory
> layout: if resource directories are missed users will not be aware but
> they will probably not be able to run unit tests at all in eclipse.
>
> - also with your suggested fix _there is no way_ in eclipse to handle
> a similar situation: you can avoid adding a resource directory twice,
> but you will never be able to have files in the same resource
> directory that go into two different target directory. For example you
> can't have all your *.properties files in src/conf to go to
> target/classes and all the test*.properties files go to
> target/test-classes. Eclipse simply doesn't allow the same source
> directory to be added twice, regardless of filters and target
> directoryies.
>
> I would prefer having the properties enabled by default, documenting
> this "eclipse limit" in plugin site and leaving to users the choice to
> setting the project property off or fixing their directory layout...
>
>
> fabrizio
>
>
>
>
>
>
> On Wed, 20 Oct 2004 06:48:20 +1000, Brett Porter <br...@apache.org> wrote:
> > There is no way the test resources should be in src/conf. It should be
> > discouraged (although not broken :)
> >
> > That said, I think the current fix is correct.
> >
> > - Brett
> >
> >
> >
> > Eric Pugh wrote:
> >
> > >Hi all,
> > >
> > >A while ago some patches where made that allowed the
> <resources/> elements
> > >to be added to the Eclipse .classpath.  This looked good, and
> I committed
> > >it.  However, as I have gone on with more testing, I think
> this needs to be
> > >reworked.
> > >
> > >What happens is right now the resources for the regular java
> files and in
> > >the <unitTest> section are duplicated...  This can lead to a
> situation where
> > >you import the same path twice.  For example, in the below (trimmed)
> > >section, I want to copy some resources always, and a
> log4j.properties when
> > >running unit tests:
> > >
> > ><build>
> > >        <unitTest>
> > >            <resources>
> > >                <resource>
> > >                    <directory>src/conf</directory>
> > >                    <targetPath>/</targetPath>
> > >                    <includes>
> > >                        <include>test.avalonconf.xml</include>
> > >                    </includes>
> > >                    <filtering>false</filtering>
> > >                </resource>
> > >                <resource>
> > >                    <includes>
> > >                        <include>log4j.properties</include>
> > >                    </includes>
> > >                    <filtering>false</filtering>
> > >                </resource>
> > >            </resources>
> > >        </unitTest>
> > >        <resources>
> > >            <resource>
> > >                <directory>src/conf</directory>
> > >                <targetPath>/</targetPath>
> > >                <includes>
> > >                    <include>hibernate.hbm.xml</include>
> > >                    <include>ehcache.xml</include>
> > >                </includes>
> > >                <filtering>false</filtering>
> > >            </resource>
> > >        </resources>
> > >    </build>
> > >
> > >However, because they both go from src/conf to /, this causes
> two records to
> > >be created in Eclipse.  I think, what needs to done is that a
> map of all the
> > >possible sources needs to be made, and then we aggreagate
> together all the
> > >changes.  However, this is a pretty big change, and I've not
> got the time
> > >for it right now, but I'll be happy to help.
> > >
> > >Also, we where not properly dealing with includes and excludes
> either..  I
> > >added that.
> > >
> > >Because this change can break things, I've added an extra check.  If
> > >maven.eclipse.addResources=true in your project.properties, then the
> > >existing logic will occur.  By default this is turned off so
> we don't start
> > >breaking everybodies builds.
> > >
> > >Eric Pugh
> > >
> > >
> > >
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > >For additional commands, e-mail: dev-help@maven.apache.org
> > >
> > >
> > >
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org


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


Re: [eclipse] Need to rethink using pom.build.resources in .classpath for Eclipse Plugin

Posted by Fabrizio Giustina <fg...@gmail.com>.
I also think that having a single directory for both "standard" and
"test" resources is pretty unusual and should be discouraged...

a common project layout is usually something like:
src/
  main
  resources
  test
  test-resources

said that, I would like to see the include resource property ON by
default also for the following considerations:

- loosing source resources will break probably more builds than having
resource folders added twice for projects with such unusual directory
layout: if resource directories are missed users will not be aware but
they will probably not be able to run unit tests at all in eclipse.

- also with your suggested fix _there is no way_ in eclipse to handle
a similar situation: you can avoid adding a resource directory twice,
but you will never be able to have files in the same resource
directory that go into two different target directory. For example you
can't have all your *.properties files in src/conf to go to
target/classes and all the test*.properties files go to
target/test-classes. Eclipse simply doesn't allow the same source
directory to be added twice, regardless of filters and target
directoryies.

I would prefer having the properties enabled by default, documenting
this "eclipse limit" in plugin site and leaving to users the choice to
setting the project property off or fixing their directory layout...


fabrizio






On Wed, 20 Oct 2004 06:48:20 +1000, Brett Porter <br...@apache.org> wrote:
> There is no way the test resources should be in src/conf. It should be
> discouraged (although not broken :)
> 
> That said, I think the current fix is correct.
> 
> - Brett
> 
> 
> 
> Eric Pugh wrote:
> 
> >Hi all,
> >
> >A while ago some patches where made that allowed the <resources/> elements
> >to be added to the Eclipse .classpath.  This looked good, and I committed
> >it.  However, as I have gone on with more testing, I think this needs to be
> >reworked.
> >
> >What happens is right now the resources for the regular java files and in
> >the <unitTest> section are duplicated...  This can lead to a situation where
> >you import the same path twice.  For example, in the below (trimmed)
> >section, I want to copy some resources always, and a log4j.properties when
> >running unit tests:
> >
> ><build>
> >        <unitTest>
> >            <resources>
> >                <resource>
> >                    <directory>src/conf</directory>
> >                    <targetPath>/</targetPath>
> >                    <includes>
> >                        <include>test.avalonconf.xml</include>
> >                    </includes>
> >                    <filtering>false</filtering>
> >                </resource>
> >                <resource>
> >                    <includes>
> >                        <include>log4j.properties</include>
> >                    </includes>
> >                    <filtering>false</filtering>
> >                </resource>
> >            </resources>
> >        </unitTest>
> >        <resources>
> >            <resource>
> >                <directory>src/conf</directory>
> >                <targetPath>/</targetPath>
> >                <includes>
> >                    <include>hibernate.hbm.xml</include>
> >                    <include>ehcache.xml</include>
> >                </includes>
> >                <filtering>false</filtering>
> >            </resource>
> >        </resources>
> >    </build>
> >
> >However, because they both go from src/conf to /, this causes two records to
> >be created in Eclipse.  I think, what needs to done is that a map of all the
> >possible sources needs to be made, and then we aggreagate together all the
> >changes.  However, this is a pretty big change, and I've not got the time
> >for it right now, but I'll be happy to help.
> >
> >Also, we where not properly dealing with includes and excludes either..  I
> >added that.
> >
> >Because this change can break things, I've added an extra check.  If
> >maven.eclipse.addResources=true in your project.properties, then the
> >existing logic will occur.  By default this is turned off so we don't start
> >breaking everybodies builds.
> >
> >Eric Pugh
> >
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
> >
> >
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 
>

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


Re: [eclipse] Need to rethink using pom.build.resources in .classpath for Eclipse Plugin

Posted by Brett Porter <br...@apache.org>.
There is no way the test resources should be in src/conf. It should be 
discouraged (although not broken :)

That said, I think the current fix is correct.

- Brett

Eric Pugh wrote:

>Hi all,
>
>A while ago some patches where made that allowed the <resources/> elements
>to be added to the Eclipse .classpath.  This looked good, and I committed
>it.  However, as I have gone on with more testing, I think this needs to be
>reworked.
>
>What happens is right now the resources for the regular java files and in
>the <unitTest> section are duplicated...  This can lead to a situation where
>you import the same path twice.  For example, in the below (trimmed)
>section, I want to copy some resources always, and a log4j.properties when
>running unit tests:
>
><build>
>        <unitTest>
>            <resources>
>                <resource>
>                    <directory>src/conf</directory>
>                    <targetPath>/</targetPath>
>                    <includes>
>                        <include>test.avalonconf.xml</include>
>                    </includes>
>                    <filtering>false</filtering>
>                </resource>
>                <resource>
>                    <includes>
>                        <include>log4j.properties</include>
>                    </includes>
>                    <filtering>false</filtering>
>                </resource>
>            </resources>
>        </unitTest>
>        <resources>
>            <resource>
>                <directory>src/conf</directory>
>                <targetPath>/</targetPath>
>                <includes>
>                    <include>hibernate.hbm.xml</include>
>                    <include>ehcache.xml</include>
>                </includes>
>                <filtering>false</filtering>
>            </resource>
>        </resources>
>    </build>
>
>However, because they both go from src/conf to /, this causes two records to
>be created in Eclipse.  I think, what needs to done is that a map of all the
>possible sources needs to be made, and then we aggreagate together all the
>changes.  However, this is a pretty big change, and I've not got the time
>for it right now, but I'll be happy to help.
>
>Also, we where not properly dealing with includes and excludes either..  I
>added that.
>
>Because this change can break things, I've added an extra check.  If
>maven.eclipse.addResources=true in your project.properties, then the
>existing logic will occur.  By default this is turned off so we don't start
>breaking everybodies builds.
>
>Eric Pugh
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>For additional commands, e-mail: dev-help@maven.apache.org
>
>
>
>
>  
>



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