我在我的pom.xml
中添加了这样的jspc插件<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">
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo.jspc</groupId>
<artifactId>jspc-maven-plugin</artifactId>
<version>2.0-alpha-3</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<inputwebxml>${basedir}/src/main/webapp/WEB-INF/web.xml</inputwebxml>
<sources>
<directory>${basedir}/src/main/webapp/jsp</directory>
<includes>
<include>**/*.jsp</include>
</includes>
</sources>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo.jspc</groupId>
<artifactId>jspc-compiler-tomcat6</artifactId>
<version>2.0-alpha-3</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
但是,当我运行mvn clean dependency:copy-dependencies install
时,我没有看到任何类生成。从这里http://hasini-gunasinghe.blogspot.com/2011/09/how-to-use-pre-compiled-jsps-in-webapp.html,我应该看到一个target/jsp-source
目录,但我没有。
我的pom.xml有问题吗?
答案 0 :(得分:1)
问题是您在<pluginManagement>
内声明了插件,并且未在<plugins>
内声明。引用Maven文档(强调我的):
插件管理包含插件元素的方式大致相同,只是不是为这个特定项目构建配置插件信息,它旨在配置从此继承的项目构建
这不是这种情况。
因此,您只需删除<pluginManagement>
元素,然后直接在<plugins>
内声明插件。
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo.jspc</groupId>
<artifactId>jspc-maven-plugin</artifactId>
<version>2.0-alpha-3</version>
<!-- rest of configuration -->
</plugin>
</plugins>
</buil>