aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2007-08-04 10:58:40 +0000
committerBrett Porter <brett@apache.org>2007-08-04 10:58:40 +0000
commit8205cd60f9ca7dbf3135e60f7ea0ca44c65e1195 (patch)
tree53edd3abddb49a47c8c619ecce4f4d7e03d86c4e
parent498d33c645a03a5132d73ae8cf61c3998f550277 (diff)
downloadarchiva-8205cd60f9ca7dbf3135e60f7ea0ca44c65e1195.tar.gz
archiva-8205cd60f9ca7dbf3135e60f7ea0ca44c65e1195.zip
[MRM-447] Jasper is only included if built with a profile
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@562691 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-web/archiva-webapp/pom.xml92
-rw-r--r--archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java25
-rw-r--r--archiva-web/archiva-webapp/src/main/resources/xwork.xml1
-rw-r--r--archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/basicReport.jsp62
4 files changed, 144 insertions, 36 deletions
diff --git a/archiva-web/archiva-webapp/pom.xml b/archiva-web/archiva-webapp/pom.xml
index 89378a9bf..9bbb40777 100644
--- a/archiva-web/archiva-webapp/pom.xml
+++ b/archiva-web/archiva-webapp/pom.xml
@@ -18,7 +18,8 @@
~ under the License.
-->
-<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">
+<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven.archiva</groupId>
@@ -211,11 +212,6 @@
<artifactId>activation</artifactId>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>jasperreports</groupId>
- <artifactId>jasperreports</artifactId>
- <version>1.2.0</version>
- </dependency>
</dependencies>
<build>
<plugins>
@@ -397,29 +393,13 @@
<configuration>
<tasks>
<copy todir="${project.build.directory}/appserver-base">
- <fileset dir="src/appserver-base" />
+ <fileset dir="src/appserver-base"/>
</copy>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jasperreports-maven-plugin</artifactId>
- <version>1.0-SNAPSHOT</version>
- <executions>
- <execution>
- <phase>compile</phase>
- <goals>
- <goal>compile-reports</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <targetDirectory>src/main/webapp/WEB-INF/jasperreports</targetDirectory>
- </configuration>
- </plugin>
</plugins>
</build>
<profiles>
@@ -465,17 +445,57 @@
</plugins>
</build>
</profile>
- </profiles>
- <pluginRepositories>
- <pluginRepository>
- <id>Codehaus Snapshots</id>
- <url>http://snapshots.repository.codehaus.org/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </pluginRepository>
- </pluginRepositories>
+ <profile>
+ <!--
+ Inclusion of this profile brings in Jasper, which is not distributed by default due to ASF licensing policy
+ regarding LGPL dependencies. A basic report is used instead.
+
+ Note: in the future, it may be better to use the jasperreports plugin at all times (so the compiled report is
+ included), so that we just require that the JAR be on the classpath to activate it. We haven't taken this step
+ here because the jasperreports plugin is not yet released.
+
+ See also: MRM-447
+ -->
+ <id>jasper</id>
+ <dependencies>
+ <dependency>
+ <groupId>jasperreports</groupId>
+ <artifactId>jasperreports</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jasperreports-maven-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>compile-reports</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <targetDirectory>src/main/webapp/WEB-INF/jasperreports</targetDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>Codehaus Snapshots</id>
+ <url>http://snapshots.repository.codehaus.org/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
</project>
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
index 570d3b0a4..17c84ada6 100644
--- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
+++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
@@ -75,6 +75,10 @@ public class GenerateReportAction
public static final String BLANK = "blank";
+ public static final String BASIC = "basic";
+
+ private static Boolean jasperPresent;
+
public String execute()
throws Exception
{
@@ -114,12 +118,33 @@ public class GenerateReportAction
{
return BLANK;
}
+ else if ( !isJasperPresent() )
+ {
+ return BASIC;
+ }
else
{
return SUCCESS;
}
}
+ private static boolean isJasperPresent()
+ {
+ if ( jasperPresent == null )
+ {
+ try
+ {
+ Class.forName( "net.sf.jasperreports.engine.JRExporterParameter" );
+ jasperPresent = Boolean.TRUE;
+ }
+ catch ( ClassNotFoundException e )
+ {
+ jasperPresent = Boolean.FALSE;
+ }
+ }
+ return jasperPresent.booleanValue();
+ }
+
private Constraint configureConstraint()
{
Constraint constraint;
diff --git a/archiva-web/archiva-webapp/src/main/resources/xwork.xml b/archiva-web/archiva-webapp/src/main/resources/xwork.xml
index 8ac578ef7..7a0b36b2f 100644
--- a/archiva-web/archiva-webapp/src/main/resources/xwork.xml
+++ b/archiva-web/archiva-webapp/src/main/resources/xwork.xml
@@ -401,6 +401,7 @@
<param name="dataSource">reports</param>
<param name="format">HTML</param>
</result>
+ <result name="basic">/WEB-INF/jsp/reports/basicReport.jsp</result>
<result name="blank">/WEB-INF/jsp/reports/blankReport.jsp</result>
</action>
</package>
diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/basicReport.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/basicReport.jsp
new file mode 100644
index 000000000..902c4e906
--- /dev/null
+++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/basicReport.jsp
@@ -0,0 +1,62 @@
+<%--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ --%>
+
+<%@ taglib prefix="ww" uri="/webwork" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="archiva" uri="http://maven.apache.org/archiva" %>
+
+<html>
+<head>
+ <title>Reports</title>
+ <ww:head/>
+</head>
+
+<body>
+<h1>Reports</h1>
+
+<div id="contentArea">
+
+ <ww:set name="reports" value="reports"/>
+ <c:forEach items="${reports}" var="report">
+
+ <p>
+ <archiva:groupIdLink var="${report.groupId}" includeTop="true"/>
+
+ <c:set var="url">
+ <ww:url action="browseArtifact" namespace="/">
+ <ww:param name="groupId" value="%{'${report.groupId}'}"/>
+ <ww:param name="artifactId" value="%{'${report.artifactId}'}"/>
+ </ww:url>
+ </c:set>
+ <a href="${url}">${report.artifactId}</a> /
+ <strong>${report.version}</strong>
+ </p>
+
+ <blockquote>${report.message}</blockquote>
+ </c:forEach>
+
+ <ww:set name="page" value="page"/>
+ <c:if test="${page > 1}"><a href="<ww:property value='prev' />">&lt;&lt;</a></c:if>
+ Page: ${page}
+ <ww:set name="isLastPage" value="isLastPage"/>
+ <c:if test="${!isLastPage}"><a href="<ww:property value='next' />">&gt;&gt;</a></c:if>
+
+</div>
+</body>
+</html>