【问题标题】:jspc-maven-plugin - inconsistent genereated class directoryjspc-maven-plugin - 生成的类目录不一致
【发布时间】:2010-07-28 10:35:19
【问题描述】:

我有一个具有以下配置的网络应用程序(继承自父母的 pluginManagement)。 JSPC 可以很好地预编译我的 JSP,但是有一些非常奇怪的行为:

在我的网络应用程序中,如果我运行 mvn clean install,编译后的 JSP 类会按照我的意愿放置在目标/类中。 如果我在不清理的情况下运行 mvn install,则编译后的 JSP 将与 JSP 本身并排放置在 target/jsp-source/jsp 中

结果是在非干净运行时,它是旧版本的 JSP 类被包含在 WAR 中。

有人知道为什么会这样吗?

<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>

谢谢

加里

【问题讨论】:

    标签: jsp maven-2


    【解决方案1】:

    我想我找到了。

    默认行为是将 jsp 文件编译到 target/jsp-source/jsp。然后将生成的类文件移动到目标/类。

    但是,移动是使用 Java 的 file.rename() 方法执行的,如果目标/类中已经存在具有预期名称的文件,则该方法不能保证行为。我猜在 Windows 上,它只是中止了重命名。

    我看到代码的当前主干版本 (2.0-alpha-4-SNAPSHOT) 使用 Groovy 来调用 Ant Copy,如果它比新文件旧,这将导致现有文件被覆盖。这就是我需要的,我会尝试的,即使它是 alpha 的快照。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多