tags:

views:

43

answers:

1

Hi

I have a web-app with the configuration below (inherited from a parent's pluginManagement). JSPC precompiles my JSPs just fine but there is some really weird behaviour:

In my web-app, if I run of mvn clean install, the compiled JSP class gets placed in target/classes just like I want. If I then run mvn install without cleaning, the compiled JSP is placed alongside the JSP itself in target/jsp-source/jsp

Result is that on a non-clean run, it's the old version of the JSP class that gets included in the WAR.

Anyone know why this might be happening?

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jspc-maven-plugin</artifactId>
<version>1.4.6</version>
<executions>
    <execution>
        <id>jspc</id>
        <goals>
            <goal>compile</goal>
        </goals>
        <configuration>
            <injectString>&lt;!-- [INSERT JSPC FRAGMENT HERE] --&gt;</injectString>
        </configuration>
    </execution>
</executions>
<dependencies>
    <dependency>
        <groupId>org.codehaus.mojo.jspc</groupId>
        <!-- change tomcat6 to tomcat5 below for 5.5 compatibility  -->
        <artifactId>jspc-compiler-tomcat6</artifactId>
        <version>2.0-alpha-3</version>
    </dependency>
</dependencies></plugin>

Thanks

Gary

A: 

I think I found it.

Default behaviour is that jsp files are compiled to target/jsp-source/jsp. The resulting class file is then moved to target/classes.

However, the move is executed using Java's file.rename() method, which does not guarantee behaviour if a file with the intended name already exists in target/classes. I guess on Windows, it just aborts the rename.

I see the current trunk version of the code (2.0-alpha-4-SNAPSHOT) uses Groovy to call an Ant Copy instead, this will cause the existing file to be over-written if it's older than the new file. That's what I need, I'll try that, even though it's an SNAPSHOT of an alpha.