Re: Running Groovy scripts with project's compile classpath

2009-02-15 Thread Torben S. Giesselmann

Hi there -- has nobody *ever* tried this? :-/

Regards,
- Torben



Torben S. Giesselmann wrote:

Hi there,

I'm trying to post-process some classes of my project using a Groovy 
script. During the process-classes phase, I'm executing a Groovy script 
using gmaven-plugin (1.0-rc-4).


However, loading any class from the project's classes (regular Java 
classes) fails. This code fails with a ClassNotFoundException:


[snip]

Class clz = this.getClass().forName(net.foogoo.test.maven.SomeClass)
println clz.simpleName

[snip]

net.foogoo.test.maven.SomeClass is present as a Java file and compiles 
successfully.



Here is my POM:

[snip]

project xmlns=http://maven.apache.org/POM/4.0.0;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd;

modelVersion4.0.0/modelVersion
groupIdnet.foogoo.maven.test/groupId
artifactIdgroovy-classpath/artifactId
version0.0.1-SNAPSHOT/version

build
plugins
   
plugin

groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-compiler-plugin/artifactId
configuration
source1.5/source
target1.5/target
/configuration
/plugin
   
plugin

groupIdorg.codehaus.groovy.maven/groupId
artifactIdgmaven-plugin/artifactId
executions
execution
phaseprocess-classes/phase
goals
goalexecute/goal
/goals
configuration
scriptpath

filefile://${pom.basedir}/target/classes/file

/scriptpath
source

${pom.basedir}/src/build/groovy/ClassExplorer.groovy

/source
/configuration
/execution
/executions
/plugin
   
/plugins

/build
/project

[snip]

As you can see, I already tried adding adding target/classes to 
scriptpath, but it makes no difference. I'm somewhat clueless. Any ideas 
how to execute my script with the project's compile classpath?


Many thanks in advance!

Best regards,
- Torben





--
Torben S. Giesselmann
tsg-sw...@foogoo.net

A clear conscience is usually the sign of a bad memory.


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



Running Groovy scripts with project's compile classpath

2009-02-12 Thread Torben S. Giesselmann

Hi there,

I'm trying to post-process some classes of my project using a Groovy 
script. During the process-classes phase, I'm executing a Groovy script 
using gmaven-plugin (1.0-rc-4).


However, loading any class from the project's classes (regular Java 
classes) fails. This code fails with a ClassNotFoundException:


[snip]

Class clz = this.getClass().forName(net.foogoo.test.maven.SomeClass)
println clz.simpleName

[snip]

net.foogoo.test.maven.SomeClass is present as a Java file and compiles 
successfully.



Here is my POM:

[snip]

project xmlns=http://maven.apache.org/POM/4.0.0;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
	xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd;

modelVersion4.0.0/modelVersion
groupIdnet.foogoo.maven.test/groupId
artifactIdgroovy-classpath/artifactId
version0.0.1-SNAPSHOT/version

build
plugins

plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-compiler-plugin/artifactId
configuration
source1.5/source
target1.5/target
/configuration
/plugin

plugin
groupIdorg.codehaus.groovy.maven/groupId
artifactIdgmaven-plugin/artifactId
executions
execution
phaseprocess-classes/phase
goals
goalexecute/goal
/goals
configuration
scriptpath

filefile://${pom.basedir}/target/classes/file
/scriptpath
source

${pom.basedir}/src/build/groovy/ClassExplorer.groovy
/source
/configuration
/execution
/executions
/plugin

/plugins
/build
/project

[snip]

As you can see, I already tried adding adding target/classes to 
scriptpath, but it makes no difference. I'm somewhat clueless. Any ideas 
how to execute my script with the project's compile classpath?


Many thanks in advance!

Best regards,
- Torben


--
Torben S. Giesselmann
tsg-sw...@foogoo.net

A clear conscience is usually the sign of a bad memory.


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