从今天起我们就不能再建贾斯珀文件了。我们使用jasperreports-maven-plugin来实现这个功能。
在maven 2.2.1中,配置如下:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jasperreports-maven-plugin</artifactId>
<version>1.0-beta-2</version>
<executions>
<execution>
<goals>
<goal>compile-reports</goal>
</goals>
<configuration>
<sourceDirectory>${basedir}/src/main/resources/reports</sourceDirectory>
<outputDirectory>>${project.build.directory}/classes/reports</outputDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>5.5.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>compile</scope>
</dependency>
</dependencies>
<configuration>
<sourceDirectory>C:\Windows\TEMP/src/main/resources/reports</sourceDirectory>
<outputDirectory>C:\Windows\TEMP\target/classes/reports</outputDirectory>
</configuration>
</plugin>但是,就像前面说的,从今天开始,我们得到了这个构建错误:
...
Downloading: http://repo1.maven.org/maven2/itext/itext/4.2.0/itext-4.2.0.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) itext:itext:jar:4.2.0
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=itext -DartifactId=itext -Dversion=4.2.0 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=itext -DartifactId=itext -Dversion=4.2.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.codehaus.mojo:jasperreports-maven-plugin:maven-plugin:1.0-beta-2
2) jasperreports:jasperreports:jar:1.2.0
3) itext:itext:jar:4.2.0我认为另一个问题(Dependency error in jasper-reports from itext)与他的有关。我尝试了Meher的解决方案来使用maven 3.2.3。这似乎是一个解决方案,但我们现在不能升级到这个maven版本。所以我需要另一个解决方案来解决这个问题。有什么想法吗?我已经尝试排除依赖项并使用固定版本,但是我没有成功地完成我的构建。我的意思是:
<!-- Compile jasper reports -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jasperreports-maven-plugin</artifactId>
<version>1.0-beta-2</version>
<configuration>
<sourceDirectory>${basedir}/src/main/resources/reports</sourceDirectory>
<outputDirectory>${project.build.directory}/classes/reports</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>compile-reports</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jasperreports-maven-plugin</artifactId>
<version>1.0-beta-2</version>
<exclusions>
<exclusion>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>5.5.1</version>
<exclusions>
<exclusion>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>
</dependencies>
</plugin>为什么插件仍然在搜索itext:itext:jar:4.2.0?有什么想法或建议来解决这个问题吗?
谢谢!
发布于 2015-07-14 12:09:23
我用蚂蚁来建立贾斯珀报告来解决我的问题。所以我跳过了插件。
我的蚂蚁任务如下:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven-antrun-plugin.version}</version>
<executions>
<execution>
<id>compile-jasper-reports</id>
<goals>
<goal>run</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<target>
<echo message="Start compile of jasper reports"/>
<mkdir dir="${project.build.directory}/classes/reports"/>
<taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask" classpathref="maven.compile.classpath" />
<jrc srcdir="${basedir}/src/main/resources/reports"
destdir="${project.build.directory}/classes/reports"
tempdir="${project.build.directory}/classes/reports"
keepjava="true"
xmlvalidation="true">
<classpath refid="maven.compile.classpath"/>
<include name="**/*.jrxml"/>
</jrc>
</target>
</configuration>
</execution>
</executions>
</plugin>发布于 2015-07-14 08:40:56
背景:
iText Group NV是Maven Central上的groupId com.lowagie和com.itextpdf的所有者。2009年7月,iText集团NV发布了com.lowagie:itext版本2.1.7。2009年12月,iText集团NV发布的下一个版本是com.itextpdf:itextpdf版本5.0.0。目前的版本(截至2015年12月)是5.5.8。
iText Group从未发布过4.x.x__版本。
在2011年的某个地方,一家名为InProTopia的公司“劫持”了com.lowagie,并发布了一个版本号为4.2.0的iText叉。根据Maven Central的指导方针,他们应该以com.inprotopia:itext的形式发布这个版本,但是他们没有,后来他们发布了一个带有自己的补丁的4.2.1。最近,iText集团NV获得了com.lowagie的所有权,并发布了一个版本4.2.2,并将其重定向到com.itextpdf:itextpdf版本5.5.6 (当时的当前版本)。
可能的解决办法:
com.lowagie iText,则需要在pom.xml中设置固定版本。最后一次正式发布是2.1.7。com.itextpdf:itextpdf 5.5.8 (截至2015年12月)。jasperreports。它显式地依赖于iText 2.1.7.js,它是Jasper的自定义iText版本。更多信息在iText博客。http://itextpdf.com/maven-update-problem-with-itext-4.2.2
发布于 2015-07-21 00:33:30
尝试添加以下存储库:
<repository>
<url>https://repository.liferay.com/nexus/content/groups/public/</url>
<id>liferay</id>
<name>Liferay</name>
</repository>祝好运!
https://stackoverflow.com/questions/31391753
复制相似问题