質問編集履歴

7

a

2022/06/04 12:46

投稿

tanaka_123
tanaka_123

スコア3

test CHANGED
File without changes
test CHANGED
@@ -39,7 +39,7 @@
39
39
  その中身がparentにあるorg.springframework.bootパッケージしかなく、
40
40
 
41
41
  jarを利用する側で
42
- import com.example
42
+ import Common
43
43
  が認識されない状況です。
44
44
 
45
45
  jarの中身に、自分自身(今回だとCommonのsrcパッケージ)が含まれるようにするには、どのようにpom.xmlを記載するべきでしょうか。

6

aa

2022/06/04 09:55

投稿

tanaka_123
tanaka_123

スコア3

test CHANGED
File without changes
test CHANGED
@@ -7,31 +7,33 @@
7
7
 
8
8
  ①のpom.xmlには下記のような記載をしております。(一部)
9
9
 
10
+
10
- **
11
+ ```ここに言語を入力
11
12
  <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
12
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
13
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
13
14
  <modelVersion>4.0.0</modelVersion>
14
- <parent>
15
- <groupId>org.springframework.boot</groupId>
16
- <artifactId>spring-boot-starter-parent</artifactId>
17
- <version>2.4.2</version>
18
- <relativePath/> <!-- lookup parent from repository -->
19
- </parent>
20
- <packaging>pom</packaging>
21
- <groupId>org.slf4j</groupId>
22
- <artifactId>slf4j-api</artifactId>
23
- <version>1.7.30</version>
24
15
 
16
+ <parent>
17
+ <groupId>org.springframework.boot</groupId>
18
+ <artifactId>spring-boot-starter-parent</artifactId>
19
+ <version>2.4.2</version>
20
+ <relativePath/> <!-- lookup parent from repository -->
21
+ </parent>
22
+ <packaging>pom</packaging>
23
+
24
+ <groupId>Common</groupId>
25
+ <artifactId>Common</artifactId>
26
+ <version>1.7.30</version>
27
+
25
- <build>
28
+ <build>
26
29
  <plugins>
27
- <plugin>
30
+ <plugin>
28
- <groupId>org.springframework.boot</groupId>
31
+ <groupId>org.springframework.boot</groupId>
29
- <artifactId>spring-boot-maven-plugin</artifactId>
32
+ <artifactId>spring-boot-maven-plugin</artifactId>
30
- </plugin>
33
+ </plugin>
31
- </plugins>
34
+ </plugins>
32
- </build>
35
+ </build>
33
-
34
- **
36
+ ```
35
37
 
36
38
  上記の内容で、Commonに対してmvn packageをすると、確かにjarは作られるのですが、
37
39
  その中身がparentにあるorg.springframework.bootパッケージしかなく、

5

あああ

2022/06/04 09:51

投稿

tanaka_123
tanaka_123

スコア3

test CHANGED
File without changes
test CHANGED
@@ -18,11 +18,9 @@
18
18
  <relativePath/> <!-- lookup parent from repository -->
19
19
  </parent>
20
20
  <packaging>pom</packaging>
21
-
22
- <groupId>com.example</groupId>
21
+ <groupId>org.slf4j</groupId>
23
- <artifactId>Service1Parent</artifactId>
22
+ <artifactId>slf4j-api</artifactId>
24
- <version>0.0.1-SNAPSHOT</version>
23
+ <version>1.7.30</version>
25
- <name>Service1</name>
26
24
 
27
25
  <build>
28
26
  <plugins>
@@ -32,6 +30,7 @@
32
30
  </plugin>
33
31
  </plugins>
34
32
  </build>
33
+
35
34
  **
36
35
 
37
36
  上記の内容で、Commonに対してmvn packageをすると、確かにjarは作られるのですが、

4

追記

2022/06/04 09:48

投稿

tanaka_123
tanaka_123

スコア3

test CHANGED
File without changes
test CHANGED
@@ -23,6 +23,15 @@
23
23
  <artifactId>Service1Parent</artifactId>
24
24
  <version>0.0.1-SNAPSHOT</version>
25
25
  <name>Service1</name>
26
+
27
+ <build>
28
+ <plugins>
29
+ <plugin>
30
+ <groupId>org.springframework.boot</groupId>
31
+ <artifactId>spring-boot-maven-plugin</artifactId>
32
+ </plugin>
33
+ </plugins>
34
+ </build>
26
35
  **
27
36
 
28
37
  上記の内容で、Commonに対してmvn packageをすると、確かにjarは作られるのですが、
@@ -33,3 +42,4 @@
33
42
  が認識されない状況です。
34
43
 
35
44
  jarの中身に、自分自身(今回だとCommonのsrcパッケージ)が含まれるようにするには、どのようにpom.xmlを記載するべきでしょうか。
45
+ excextionとかの追記が必要でしょうか。

3

誤字

2022/06/04 07:51

投稿

tanaka_123
tanaka_123

スコア3

test CHANGED
File without changes
test CHANGED
@@ -7,7 +7,8 @@
7
7
 
8
8
  ①のpom.xmlには下記のような記載をしております。(一部)
9
9
 
10
+ **
10
- **<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11
12
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
12
13
  <modelVersion>4.0.0</modelVersion>
13
14
  <parent>
@@ -16,8 +17,7 @@
16
17
  <version>2.4.2</version>
17
18
  <relativePath/> <!-- lookup parent from repository -->
18
19
  </parent>
19
- <packaging>jar</packaging>
20
+ <packaging>pom</packaging>
20
-
21
21
 
22
22
  <groupId>com.example</groupId>
23
23
  <artifactId>Service1Parent</artifactId>

2

修正

2022/06/04 07:49

投稿

tanaka_123
tanaka_123

スコア3

test CHANGED
File without changes
test CHANGED
@@ -18,6 +18,7 @@
18
18
  </parent>
19
19
  <packaging>jar</packaging>
20
20
 
21
+
21
22
  <groupId>com.example</groupId>
22
23
  <artifactId>Service1Parent</artifactId>
23
24
  <version>0.0.1-SNAPSHOT</version>

1

文法の修正

2022/06/04 07:48

投稿

tanaka_123
tanaka_123

スコア3

test CHANGED
File without changes
test CHANGED
@@ -24,7 +24,6 @@
24
24
  <name>Service1</name>
25
25
  **
26
26
 
27
-
28
27
  上記の内容で、Commonに対してmvn packageをすると、確かにjarは作られるのですが、
29
28
  その中身がparentにあるorg.springframework.bootパッケージしかなく、
30
29