Maven: JspC sollte die Verwendung von externen JSP-Dateien

Verwenden wir Maven 3 und ich stehe vor einem Projekt, das die JSP-Dateien und verwendet auch "global" JSP-Dateien gespeichert in einem anderen Projekt. Dies funktioniert gut, wenn mit maven-war-plugin und webResources. Alle JSP-Dateien finden Ihren Weg in den KRIEG-Datei.

Ist die neue Idee zu pre-kompilieren Sie alle JSPs. Die offensichtliche Wahl ist, um jspc-maven-plugin. Aber das bedeutet nicht enthalten sind die externen JSPs, wenn es kompiliert das Projekt-lokale JSPs.

Hier ist der Ausschnitt aus der pom.xml:

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jspc-maven-plugin</artifactId>
    <executions>
      <execution>
        <id>jspc</id>
        <goals>
          <goal>compile</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1</version>
    <configuration>
      <warName>${pom.groupId}.${pom.artifactId}-0.0.1-SNAPSHOT</warName>
      <webXml>${basedir}/target/jspweb.xml</webXml>
      <webResources>
        <resource>
          <directory>../name.of.external.project/src/global/webapp</directory>
        </resource>
      </webResources>
    </configuration>
  </plugin>

Den Fehler

[ERROR] Failed to execute goal org.codehaus.mojo:jspc-maven-plugin:1.4.6:compile (jspc) on project internal.project: JSPC Error: file:C:/workspace/name.of.internal.project/src/main/webapp/WEB-INF/views/show.jsp(2,0) File "/WEB-INF/views/../jspGlobal/jsp-declaration.jspf" not found -> [Help 1]

Den jspGlobal-directory kopiert, mit der <directory>../name.of.external.project/src/global/webapp</directory>-Zeile oben.

Was fehlt, fügen Sie die externe JSPs in JspC?


BEARBEITEN: Dank prunge ist und Raghuram Eingang ich schaute tiefer in Quellen und JavaDocs. Ich bemerkte, dass die genannten sources erfordert eine FileSet die es NICHT erlaubt, eine Liste von Verzeichnissen. Und da sources ist auch keine Liste, ich sehe keine chance, wie kann ich angeben, mehr als eine JSP-Quellcode-Verzeichnis. Ich habe sogar versucht, kopieren Sie die <plugin>-element, aber das hat nicht geholfen. Meine aktuelle situation ist folgende:

  <plugin>
    <groupId>org.codehaus.mojo.jspc</groupId>
    <artifactId>jspc-maven-plugin</artifactId>
    <version>2.0-alpha-3</version>
    <executions>
      <execution>
        <id>jspc</id>
        <goals>
          <goal>compile</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <sources>
        <directory>${basedir}/../name.of.external.project/src/global/webapp</directory>
      </sources>
<!-- the later mentioned <sources> gets picked
      <sources>
        <directory>${basedir}/src/main/webapp</directory>
      </sources>
-->
      <!-- 1.6 doesn't work!? Something lower than 1.5 seems to be the default -->
      <source>1.5</source>
      <target>1.5</target>
    </configuration>
    <dependencies>
      <dependency>
        <groupId>org.codehaus.mojo.jspc</groupId>
        <artifactId>jspc-compiler-tomcat6</artifactId>
        <version>2.0-alpha-3</version>
      </dependency>
    </dependencies>
  </plugin>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1</version>
    <configuration>
      <warName>${pom.groupId}.${pom.artifactId}-0.0.1-SNAPSHOT</warName>
      <webXml>${basedir}/target/jspweb.xml</webXml>
      <webResources>
        <resource>
          <directory>../name.of.external.project/src/global/webapp</directory>
        </resource>
      </webResources>
    </configuration>
  </plugin>

Nun ist die externe JSPs kompiliert werden, in der Ziel-Pfad des aktuellen Projekts. Jetzt brauche ich eine Möglichkeit zur Kompilierung der JSPs und des aktuellen Projekts. Wie mache ich das?

BTW, wenn ich schalten Sie die <sources> zu der Zeile für das aktuelle Projekt bekomme ich die gleiche Fehlermeldung wie bereits erwähnt.

InformationsquelleAutor sjngm | 2011-08-23
Schreibe einen Kommentar