mirror of https://github.com/apache/archiva.git
[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
This commit is contained in:
parent
498d33c645
commit
8205cd60f9
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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' />"><<</a></c:if>
|
||||
Page: ${page}
|
||||
<ww:set name="isLastPage" value="isLastPage"/>
|
||||
<c:if test="${!isLastPage}"><a href="<ww:property value='next' />">>></a></c:if>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue