Howard Lewis Ship wrote:
> 
> Using 1.0-m3.
> 
> "gradle eclipse" generates a .classpath that puts all compiled files
> into bin/  (This seems to fly in the face of the above discussion
> which indicates it should be generating output to the same folders
> that Gradle builds would, I don't think there's anything in my
> build.gradle causing this).
> 

What Adam said back then is that Eclipse projects created by Gradle should
(by default) no longer use Gradle's output folder but the one commonly used
by Eclipse, because it's the safer option. And that's what we did.


Howard Lewis Ship wrote:
> 
> In any case, how can I tell it to split it up so that production
> (src/main/*) goes to one folder (say, bin/main) and the tests go to
> another (bin/test)?
> 

You can use the "whenMerged" hook:

import org.gradle.plugins.ide.eclipse.model.SourceFolder

eclipse.classpath.whenMerged { cp ->
  cp.entries.findAll { it instanceof SourceFolder &&
it.path.startsWith("src/main/") }*.output = "bin/main"
  cp.entries.findAll { it instanceof SourceFolder &&
it.path.startsWith("src/test/") }*.output = "bin/test"
}

--
Peter Niederwieser
Principal Engineer, Gradleware 
http://gradleware.com
Creator, Spock Framework 
http://spockframework.org
Twitter: @pniederw




Thanks in advance.

On Tue, Jan 11, 2011 at 2:17 PM, Adam Murdoch <[email protected]> wrote:
>
> On 12/01/2011, at 2:23 AM, Philip Crotwell wrote:
>
> This is a very good reason to separate the two. Eclipse happily
> generates .class files even on compile failures, so you can end up
> with the very confusing situation of gradle thinking everything is ok
> when it ain't.
>
> You shouldn't be seeing this in 0.9 or later. Gradle is now very careful
> in
> making sure the contents of the classes directory is accurate, even in the
> fact of external changes.
>
> Very confusing to a new users, and then once you know
> what it going on you do a lot of "gradle clean" negating any benefit
> of the shared compile space. I have been bitten by this one more times
> than I can count! :(
>
> Philip
>
> On Mon, Jan 10, 2011 at 6:25 PM, Dave King <[email protected]> wrote:
>
> John - have you been able to configure it?  We've tried and have not
>
> been able to.  There is a jira issue that's been opened.
>
> The eclipse compiler will compile almost anything including syntax
>
> errors - putting in a runtime exception.  This means that graddle
>
> won't recompile the not quite compiled eclipse code.  When I build
>
> with graddle I want to know it's a graddle build not a mix, an no I
>
> don't want to have to do a clean to get that to work.
>
> Also the eclipse compiler does things slightly differently than javac
>
> with regards to syntax and how it builds class files.  I've had code
>
> that works with javac and fails with eclipse, it's an obscure case
>
> dealing with initialization and superclass constructor calls but it's
>
> there.  So I never want to mix the two.
>
> - Peace
>
> Dave
>
>
> On Mon, Jan 10, 2011 at 4:18 PM, John Murph <[email protected]>
> wrote:
>
> Why do you think this is not such a great idea?  This way, if I build in
>
> Gradle, I can run/debug from the IDE.  Similarly, I can build in the IDE
> and
>
> run from Gradle.  The main downside is that the IDE and Gradle may
> disagree
>
> about what needs to be built, making builds sometimes take longer than
>
> necessary.  For me, this trade-off has been worth it.
>
> Are there downside that I'm unaware of?  It's configurable, so I don't
> mind
>
> too much if the default is changed because I can always configure it to
> work
>
> the way I want it to.  I'm just curious why you think this could be a
>
> problem.
>
>
> On Mon, Jan 10, 2011 at 4:05 PM, Adam Murdoch <[email protected]>
> wrote:
>
> Hi,
>
> The 'eclipse' and 'idea' plugins configure the IDE to compile classes into
>
> the same directories as Gradle, ie build/classes/main and
>
> build/classes/test.
>
> I think this is not such a great idea. Instead, I think these plugins
>
> should configure the IDE to compile classes into different locations.
>
> Probably whatever the default happens to be for the target IDE.
>
> --
>
> Adam Murdoch
>
> Gradle Developer
>
> http://www.gradle.org
>
> CTO, Gradle Inc. - Gradle Training, Support, Consulting
>
> http://www.gradle.biz
>
>
>
>
> --
>
> John Murph
>
> Automated Logic Research Team
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>
>
> --
> Adam Murdoch
> Gradle Developer
> http://www.gradle.org
> CTO, Gradle Inc. - Gradle Training, Support, Consulting
> http://www.gradle.biz
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



--
View this message in context: 
http://gradle.1045684.n5.nabble.com/Changing-Eclipse-output-directory-for-production-and-tests-tp4691719p4694443.html
Sent from the gradle-user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to