为什么jasperreports-maven-plugin需要itext:itext:jar:4.2.0? [英] Why does jasperreports-maven-plugin needs itext:itext:jar:4.2.0?

查看:106
本文介绍了为什么jasperreports-maven-plugin需要itext:itext:jar:4.2.0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从今天起我们无法再构建我们的jasper文件了。我们使用jasperreports-maven-plugin。

Since today we can't build our jasper file any more. We use the jasperreports-maven-plugin for this.

在maven 2.2.1中,这个配置如下:

In maven 2.2.1, this was configured like this:

<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>

但是,如上所述,从今天开始,我们遇到了这个构建错误:

But, as said, since today, we got this build error:

...
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

我认为另一个问题(来自itext的jasper-reports中的依赖性错误)与他的相关。我尝试使用Meher的解决方案来使用maven 3.2.3。这似乎是一个解决方案,但我们无法升级(现在)到这个maven版本。所以我需要另一种解决方案来解决这个问题。有任何想法吗?我已经尝试排除依赖项并使用固定版本,但我还没有成功完成构建。我的意思是:

I think another question (Dependency error in jasper-reports from itext) is related to his. And I tried the solution of Meher to use maven 3.2.3. This seems to be a solution, but we can't upgrade (now) to this maven version. So I need another solution to resolve this issue. Any ideas? I already tried to exclude dependencies and use fixed versions, but I haven't managed to succeed my build. What I mean is this:

<!-- 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?有什么想法或建议可以解决这个问题吗?

Why is the plugin still searching for itext:itext:jar:4.2.0? Any ideas or suggestions to solve this?

谢谢!

推荐答案

我通过使用ant构建我的jasper报告解决了我的问题。所以我跳过了这个插件。

I resolved my issue by using ant to build my jasper report. So I skipped the plugin.

我的ant任务看起来像这样:

My ant task looks like this:

<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>

这篇关于为什么jasperreports-maven-plugin需要itext:itext:jar:4.2.0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆