Hi Keegan,

Let me describe how everything is normally run in "deployed mode", and then what my development environment in maven/IntelliJ looks like.

Deployed mode:

Maven/IntelliJ:

I could of course just remove GMavenPlus from my pom.xml, but then my groovy code isn't compiled at all, and I do want that "safety net" to capture errors in that part of the (groovy) code.

Still a bit of a complicated description I guess, but I hope it's a little bit more clear what I'm trying to achieve now.

Maarten

On 2015-10-04 07:16, Keegan Witt wrote:
How about adding them in a non-standard directory (to avoid IntelliJ knowing where they are) then add them as test sources to GMavenPlus?  If that'd work, please see here for an example.  It might not though, because I'm not sure I'm fully understanding your use case.  It wasn't clear to me how you were deploying the scripts so you could do the GroovyClassLoader.parseClass() calls in production.

-Keegan

On Thu, Oct 1, 2015 at 3:29 AM, Maarten Boekhold <boekhold@gmx.com> wrote:
Hi all,

Not strictly a groovy-specific question I believe, but I also believe that if anybody knows the answer to this, they'll be on this list.

I am working on a project that is mixed Java and groovy code. I'm developing in IntelliJ, it's a maven project that is using GMavenPlus (1.5).

When the resulting artifact is run after I have installed it, the groovy scripts should not be on the CLASSPATH of the application; instead they are loaded dynamically (GroovyClassLoader.parseClass()). So, also inside IntelliJ, when running or debugging the full application, I want to exclude the groovy sources (or compiled artifacts) from the CLASSPATH. However, while developing I do want these scripts to be compiled so I can see any errors. Also when running unit tests the scripts will need to be on the classpath.

I'm looking for a way to achieve the following:
- Groovy sources are compiled when building the project
- Groovy artifacts are NOT on the CLASSPATH when running/debugging the application inside IntelliJ
- Groovy artifacts ARE on the CLASSPATH when running unit tests

Does anybody have any idea how to do this?

Maarten