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";>
    <modelVersion>4.0.0</modelVersion>
    <groupId>net.foogoo.maven.test</groupId>
    <artifactId>groovy-classpath</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <build>
        <plugins>
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
<plugin>
                <groupId>org.codehaus.groovy.maven</groupId>
                <artifactId>gmaven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <scriptpath>
<file>file://${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

Reply via email to