質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
JAR

JAR(又はJava ARchive)はコンパイルされた複数のJavaバイトコード及び関連ファイルのリソースを一つのファイルに統合したものです。JARファイルはZIPファイルのフォーマットで構築されています。

JasperReports

JasperReportsはオープンソースの帳票生成ツールです。JasperReportはPDF, HTML, Microsoft Excel, ODT, XML等の様々なフォーマットのものをエクスポートします。

Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Amazon EC2

Amazon EC2は“Amazon Elastic Compute Cloud”の略称です。Amazon Web Services(AWS)の一部であり、仮想化されたWebサーバーのコンピュータリソースをレンタルできるサービスです。

Apache Maven

Apache Mavenは、ソフトウェアプロジェクトの管理ツールです。

Q&A

解決済

2回答

4234閲覧

EC2上でmavenでjarを生成しようとするとエラー

mimi_129

総合スコア63

JAR

JAR(又はJava ARchive)はコンパイルされた複数のJavaバイトコード及び関連ファイルのリソースを一つのファイルに統合したものです。JARファイルはZIPファイルのフォーマットで構築されています。

JasperReports

JasperReportsはオープンソースの帳票生成ツールです。JasperReportはPDF, HTML, Microsoft Excel, ODT, XML等の様々なフォーマットのものをエクスポートします。

Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Amazon EC2

Amazon EC2は“Amazon Elastic Compute Cloud”の略称です。Amazon Web Services(AWS)の一部であり、仮想化されたWebサーバーのコンピュータリソースをレンタルできるサービスです。

Apache Maven

Apache Mavenは、ソフトウェアプロジェクトの管理ツールです。

0グッド

0クリップ

投稿2021/08/09 23:13

前提・実現したいこと

EC2上でmavenを実行してjarファイルを生成したのですが、
上手くいきません。

調べているとjasperとitextの依存関係がおかしい?ような気がするのですが。。

実行したコマンドはこちらです↓
mvn clean dependency:copy-dependencies -DoutputDirectory=lib antrun:run package

Eclipseで実行の構成からゴールを上記の引数にしてビルドを実行するとエラーなくjarが生成されます。
EC2上だと上手くいきません。

何か分かる方がいればご回答よろしくお願いします。

発生している問題・エラーメッセージ

[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 14.679 s [INFO] Finished at: 2021-08-10T08:02:58+09:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project demo: Could not resolve dependencies for project com.example:demo:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: org.olap4j:olap4j:jar:0.9.7.309-JS-3, com.lowagie:itext:jar:2.1.7.js2: Could not find artifact org.olap4j:olap4j:jar:0.9.7.309-JS-3 in central (https://repo.maven.apache.org/maven2) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

pom.xml

1<?xml version="1.0" encoding="UTF-8"?> 2<project xmlns="http://maven.apache.org/POM/4.0.0" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 5 <modelVersion>4.0.0</modelVersion> 6 <parent> 7 <groupId>org.springframework.boot</groupId> 8 <artifactId>spring-boot-starter-parent</artifactId> 9 <version>2.3.3.RELEASE</version> 10 <relativePath /> <!-- lookup parent from repository --> 11 </parent> 12 <groupId>com.example</groupId> 13 <artifactId>demo</artifactId> 14 <version>0.0.1-SNAPSHOT</version> 15 <name>demo</name> 16 <description>Demo project for Spring Boot</description> 17 18 <properties> 19 <java.version>11</java.version> 20 </properties> 21 22 <dependencies> 23 24 <!-- 自動ビルド --> 25 <dependency> 26 <groupId>org.springframework.boot</groupId> 27 <artifactId>spring-boot-devtools</artifactId> 28 </dependency> 29 30 <dependency> 31 <groupId>org.springframework.boot</groupId> 32 <artifactId>spring-boot-starter-web</artifactId> 33 </dependency> 34 35 <dependency> 36 <groupId>org.springframework.boot</groupId> 37 <artifactId>spring-boot-starter-test</artifactId> 38 <scope>test</scope> 39 <exclusions> 40 <exclusion> 41 <groupId>org.junit.vintage</groupId> 42 <artifactId>junit-vintage-engine</artifactId> 43 </exclusion> 44 </exclusions> 45 </dependency> 46 <dependency> 47 <groupId>org.springframework.boot</groupId> 48 <artifactId>spring-boot-starter-thymeleaf</artifactId> 49 </dependency> 50 51 <!-- データベースアクセス --> 52 <dependency> 53 <groupId>org.springframework.boot</groupId> 54 <artifactId>spring-boot-starter-data-jpa</artifactId> 55 </dependency> 56 <dependency> 57 <groupId>org.postgresql</groupId> 58 <artifactId>postgresql</artifactId> 59 <scope>runtime</scope> 60 </dependency> 61 <dependency> 62 <groupId>org.springframework.boot</groupId> 63 <artifactId>spring-boot-starter-jdbc</artifactId> 64 </dependency> 65 66 <dependency> 67 <groupId>org.webjars</groupId> 68 <artifactId>momentjs</artifactId> 69 <version>2.24.0</version> 70 </dependency> 71 <dependency> 72 <groupId>org.webjars</groupId> 73 <artifactId>tempusdominus-bootstrap-4</artifactId> 74 <version>5.1.2</version> 75 </dependency> 76 77 <!-- Jasper Report --> 78 <dependency> 79 <groupId>net.sf.jasperreports</groupId> 80 <artifactId>jasperreports</artifactId> 81 <version>6.1.0</version> 82 </dependency> 83 <!-- Jasper Report --> 84 <dependency> 85 <groupId>org.apache.tomcat.embed</groupId> 86 <artifactId>tomcat-embed-jasper</artifactId> 87 </dependency> 88 89 <!-- バリデーション --> 90 <dependency> 91 <groupId>javax.validation</groupId> 92 <artifactId>validation-api</artifactId> 93 </dependency> 94 <dependency> 95 <groupId>org.hibernate</groupId> 96 <artifactId>hibernate-validator</artifactId> 97 <version>5.2.4.Final</version> 98 </dependency> 99 100 <!-- lombok --> 101 <dependency> 102 <groupId>org.projectlombok</groupId> 103 <artifactId>lombok</artifactId> 104 <scope>provided</scope> 105 </dependency> 106 107 <!-- secutiry config --> 108 <dependency> 109 <groupId>org.springframework.security</groupId> 110 <artifactId>spring-security-core</artifactId> 111 </dependency> 112 <dependency> 113 <groupId>org.springframework.security</groupId> 114 <artifactId>spring-security-web</artifactId> 115 </dependency> 116 <dependency> 117 <groupId>org.springframework.security</groupId> 118 <artifactId>spring-security-config</artifactId> 119 </dependency> 120 121 <dependency> 122 <groupId>org.springframework.session</groupId> 123 <artifactId>spring-session-jdbc</artifactId> 124 </dependency> 125 126 <!-- thymeleafがSpringSecurityのroleを参照するようにする為の設定 --> 127 <dependency> 128 <groupId>org.thymeleaf.extras</groupId> 129 <artifactId>thymeleaf-extras-springsecurity5</artifactId> 130 </dependency> 131 132 <!-- https://mvnrepository.com/artifact/com.opencsv/opencsv --> 133 <dependency> 134 <groupId>com.opencsv</groupId> 135 <artifactId>opencsv</artifactId> 136 <version>5.4</version> 137 </dependency> 138 139 <!-- https://mvnrepository.com/artifact/com.lowagie/itext --> 140 <dependency> 141 <groupId>com.lowagie</groupId> 142 <artifactId>itext</artifactId> 143 <version>2.1.7.js2</version> 144 </dependency> 145 146 </dependencies> 147 148 <build> 149 <finalName>bankbank</finalName> 150 <plugins> 151 <plugin> 152 <groupId>org.springframework.boot</groupId> 153 <artifactId>spring-boot-maven-plugin</artifactId> 154 </plugin> 155 <plugin> 156 <groupId>org.apache.maven.plugins</groupId> 157 <artifactId>maven-antrun-plugin</artifactId> 158 <configuration> 159 <target> 160 <echo message="copy files" /> 161 <property name="fileDir" value="src/main/resources" /> 162 <copy file="${fileDir}/prod.application.properties" 163 tofile="${fileDir}/application.properties" overwrite="true" /> 164 </target> 165 </configuration> 166 </plugin> 167 </plugins> 168 </build> 169</project>

補足情報(FW/ツールのバージョンなど)

Apache Maven 3.6.3

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

shiketa

2021/08/10 01:28

> 実行したコマンドはこちらです↓ 親切なご提案を受けているのだから、いっぺん従ってみてはいかがでしょうか。きっともっとくわしい情報が得られるとおもいます ``` [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. ```
ababa_Sigrun

2021/08/13 05:47

JasperReportsタグではなくMavenの問題かなと見受けられます。 タグの修正お願いします。
guest

回答2

0

自己解決

やはりjasperとitextのバージョンの問題だったようです。

<dependency> <groupId>net.sf.jasperreports</groupId> <artifactId>jasperreports</artifactId> <version>6.9.0</version> <exclusions> <exclusion> <groupId>com.lowagie</groupId> <artifactId>itext</artifactId> </exclusion> </exclusions> </dependency>

にしたらいけました。

投稿2021/09/18 04:43

mimi_129

総合スコア63

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

参考にどうぞ
Qiita

投稿2021/08/13 05:57

ababa_Sigrun

総合スコア279

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問