English 中文(简体)
在Maven的jspc-Maven插件中指定类路径
原标题:Specifying the classpath in Maven s jspc-maven-plugin plugin

我正在尝试使用Maven的jspc-Maven插件来编译我的JSP。我遇到的问题是,它拒绝编译引用不在target/classes目录中的类的任何JSP。

例如。

<jsp:useBean id="MY_ID" class="com.mycompany.common.my_id" scope="session"/>

my_id类位于几个项目使用的jar中,因此它是单独构建的,然后作为项目的依赖项包含在内。

有什么方法可以让插件搜索这个jar文件的类路径吗?能够扫描存储库将是理想的选择。以下是当前插件的配置方式:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jspc-maven-plugin</artifactId>
    <version>1.4.6</version>
    <executions>
        <execution>
            <goals>
                <goal>compile</goal>
            </goals>
            <id>compile</id>
        </execution>
    </executions>
    <configuration>
    </configuration>
</plugin>

谢谢

理查德

问题回答

对于编译,插件应该使用POM文件中指定的依赖项。我不确定您使用的版本,但当正确指定编译依赖项时,最新的可以正常工作:

 <plugin>
    <groupId>org.codehaus.mojo.jspc</groupId>
    <artifactId>jspc-maven-plugin</artifactId>
    <version>2.0-alpha-3</version>
    <configuration>
      <workingDirectory>${project.build.directory}/jspc</workingDirectory>
    </configuration>
    <executions>
      <execution>
        <phase>compile</phase>
        <goals>
          <goal>compile</goal>
        </goals>
      </execution>
    </executions>
    <dependencies>
      <dependency>
        <groupId>org.codehaus.mojo.jspc</groupId>
        <artifactId>jspc-compiler-tomcat6</artifactId>
        <version>2.0-alpha-3</version>
      </dependency>
    </dependencies>
  </plugin>




相关问题
Convert typed-in Text to lowercase

I ve got an index.jsp with [snip] <% String name = request.getParameter("name"); String pass = request.getParameter("pass"); String globalname = "webeng"; String globalpass = "2009"; ...

session transfer issue from Tomcat to ASP.Net

I am using Tomcat to host JSP and using IIS 7.0 to host aspx (C# + .Net 3.5 + VSTS 2008), and I have some session transfer issue from JSP page to ASPX page. JSP page is in one domain and all other ...

Setting the default value in Struts2

I am setting the value(kind of default value) for a drop down select value from action class in a page(given below). When the page loads the value is beig displayed but the other elements of the ...

Evaluate dynamically constructed JSP at runtime

I have a requirement where in the JSP page itself is created by the user and stored in the database. When viewing results we need to render this JSP to the client, evaluating all tags inside this JSP. ...

How to Pack/Encrypt/Unpack/Decrypt a bunch of files in Java?

I m essentially trying to do the following on a Java/JSP-driven web site: User supplies a password Password is used to build a strongly-encrypted archive file (zip, or anything else) containing a ...

JSP exception - class not found (tomcat)

I m setting up an existing application on a new Tomcat 5.5 server connecting to a Postgres database (running on Debian Lenny). When I access it I get a series of stack traces with the following root ...

ArrayList to Table in JSP

I have an ArrayList and i am trying to display it in a table ..... ArrayList rows = .... ..... <table cellspacing="1" cellpadding="4" border="3"> <tr> <TH>...

热门标签