我在我的 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 http://hasini-gunasinghe.blogspot.com/2011/09/how-to-use-pre-compiled-jsps-in-webapp.html,我应该看到一个target/jsp-source
目录,但我没有。
我的 pom.xml 有问题吗?
问题是你在里面声明插件<pluginManagement> https://maven.apache.org/pom.html#Plugin_Management并且它没有在 a 内声明<plugins>
。引用 Maven 文档(强调我的):
插件管理以大致相同的方式包含插件元素,只不过不是为此特定项目构建配置插件信息,它的目的是配置继承自此的项目构建
但这里的情况并非如此。
因此,您只需删除<pluginManagement>
element 并让插件直接在里面声明<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>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)