为什么 jasperreports-maven-plugin 需要 itext:itext:jar:4.2.0?
Why does jasperreports-maven-plugin needs itext:itext:jar:4.2.0?
从今天开始,我们不能再构建我们的 jasper 文件了。为此,我们使用 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
我认为另一个问题 () 与他有关。我尝试了 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?有解决这个问题的想法或建议吗?
谢谢!
背景:
iText Group NV 是 Maven Central 上 groupId com.lowagie
和 com.itextpdf
的所有者。 iText Group NV 于 2009 年 7 月发布了 com.lowagie:itext
版本 2.1.7。iText Group NV 的下一个版本是 com.itextpdf:itextpdf
版本 5.0.0,2009 年 12 月。当前版本(截至 2015 年 12 月)是 5.5.8.
iText Group NV 从未发布过版本 4.x.x.
2011 年的某个时候,一家名为 InProTopia "hijacked" com.lowagie
的公司发布了 iText 的分支,版本号为 4.2.0。根据 [Guidelines of Maven Central][1],他们应该将其发布为 com.inprotopia:itext
,但他们没有。后来他们发布了带有自己补丁的 4.2.1。最近 iText Group NV 获得了 com.lowagie
的所有权并发布了 4.2.2 版本并重定向到 com.itextpdf:itextpdf
版本 5.5.6(当时的当前版本)。
可能的解决方案:
- 如果您需要
com.lowagie
iText,您需要在 pom.xml
中设置固定版本。最后一个正式版本是 2.1.7.
- 如果您需要 iText 4.x.x,请联系 InProTopia。祝你好运,因为他们的网站已经关闭,据我所知,那家公司已经不存在了。
- 如果您不介意使用哪个版本的 iText,请使用 iText Group NV 发布的当前 iText 版本,
com.itextpdf:itextpdf
5.5.8(如2015 年 12 月)。
- 使用最新版本
jasperreports
。它明确依赖于 iText 2.1.7.js
,这是 Jasper Reports 的自定义 iText 版本。
更多信息请访问 iText 博客。
http://itextpdf.com/maven-update-problem-with-itext-4.2.2
[1] https://maven.apache.org/guides/mini/guide-central-repository-upload.html
我通过使用 ant 构建我的 jasper 报告解决了我的问题。所以我跳过了插件。
我的蚂蚁任务是这样的:
<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>
尝试添加此存储库:
<repository>
<url>https://repository.liferay.com/nexus/content/groups/public/</url>
<id>liferay</id>
<name>Liferay</name>
</repository>
祝你好运!
从今天开始,我们不能再构建我们的 jasper 文件了。为此,我们使用 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
我认为另一个问题 (
<!-- 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?有解决这个问题的想法或建议吗?
谢谢!
背景:
iText Group NV 是 Maven Central 上 groupId com.lowagie
和 com.itextpdf
的所有者。 iText Group NV 于 2009 年 7 月发布了 com.lowagie:itext
版本 2.1.7。iText Group NV 的下一个版本是 com.itextpdf:itextpdf
版本 5.0.0,2009 年 12 月。当前版本(截至 2015 年 12 月)是 5.5.8.
iText Group NV 从未发布过版本 4.x.x.
2011 年的某个时候,一家名为 InProTopia "hijacked" com.lowagie
的公司发布了 iText 的分支,版本号为 4.2.0。根据 [Guidelines of Maven Central][1],他们应该将其发布为 com.inprotopia:itext
,但他们没有。后来他们发布了带有自己补丁的 4.2.1。最近 iText Group NV 获得了 com.lowagie
的所有权并发布了 4.2.2 版本并重定向到 com.itextpdf:itextpdf
版本 5.5.6(当时的当前版本)。
可能的解决方案:
- 如果您需要
com.lowagie
iText,您需要在pom.xml
中设置固定版本。最后一个正式版本是 2.1.7. - 如果您需要 iText 4.x.x,请联系 InProTopia。祝你好运,因为他们的网站已经关闭,据我所知,那家公司已经不存在了。
- 如果您不介意使用哪个版本的 iText,请使用 iText Group NV 发布的当前 iText 版本,
com.itextpdf:itextpdf
5.5.8(如2015 年 12 月)。 - 使用最新版本
jasperreports
。它明确依赖于 iText2.1.7.js
,这是 Jasper Reports 的自定义 iText 版本。
更多信息请访问 iText 博客。 http://itextpdf.com/maven-update-problem-with-itext-4.2.2
[1] https://maven.apache.org/guides/mini/guide-central-repository-upload.html
我通过使用 ant 构建我的 jasper 报告解决了我的问题。所以我跳过了插件。
我的蚂蚁任务是这样的:
<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>
尝试添加此存储库:
<repository>
<url>https://repository.liferay.com/nexus/content/groups/public/</url>
<id>liferay</id>
<name>Liferay</name>
</repository>
祝你好运!