teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

pom.xml、コードの追加をしました。

2021/09/19 23:31

投稿

taketake08
taketake08

スコア16

title CHANGED
@@ -1,1 +1,1 @@
1
- Visual Studio Codeでの依存性追加の方法
1
+ Visual Studio Codeでのpom.xmlへの依存性追加の方法
body CHANGED
@@ -5,6 +5,114 @@
5
5
  pom.xmlに依存性<dependency>を追加すると下記の例外が発生します。
6
6
  依存性<dependency>を排除すると下記の例外は発生しません。
7
7
 
8
+ mavenのquick-startでプロジェクトを作成しています。
9
+ 下記pom.xmlとコードです。
10
+
11
+ 【pom.xml】
12
+ ```
13
+ <?xml version="1.0" encoding="UTF-8"?>
14
+
15
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
16
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
17
+ <modelVersion>4.0.0</modelVersion>
18
+
19
+ <groupId>com.example</groupId>
20
+ <artifactId>jackson</artifactId>
21
+ <version>1.0.0</version>
22
+
23
+ <name>jackson</name>
24
+ <!-- FIXME change it to the project's website -->
25
+ <url>http://www.example.com</url>
26
+
27
+ <properties>
28
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
29
+ <maven.compiler.source>1.7</maven.compiler.source>
30
+ <maven.compiler.target>1.7</maven.compiler.target>
31
+ </properties>
32
+
33
+ <dependencies>
34
+ <dependency>
35
+ <groupId>junit</groupId>
36
+ <artifactId>junit</artifactId>
37
+ <version>4.11</version>
38
+ <scope>test</scope>
39
+ </dependency>
40
+ <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
41
+ <dependency>
42
+ <groupId>com.fasterxml.jackson.core</groupId>
43
+ <artifactId>jackson-core</artifactId>
44
+ <version>2.12.5</version>
45
+ </dependency>
46
+ </dependencies>
47
+
48
+ <build>
49
+ <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
50
+ <plugins>
51
+ <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
52
+ <plugin>
53
+ <artifactId>maven-clean-plugin</artifactId>
54
+ <version>3.1.0</version>
55
+ </plugin>
56
+ <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
57
+ <plugin>
58
+ <artifactId>maven-resources-plugin</artifactId>
59
+ <version>3.0.2</version>
60
+ </plugin>
61
+ <plugin>
62
+ <artifactId>maven-compiler-plugin</artifactId>
63
+ <version>3.8.0</version>
64
+ </plugin>
65
+ <plugin>
66
+ <artifactId>maven-surefire-plugin</artifactId>
67
+ <version>2.22.1</version>
68
+ </plugin>
69
+ <plugin>
70
+ <artifactId>maven-jar-plugin</artifactId>
71
+ <version>3.0.2</version>
72
+ </plugin>
73
+ <plugin>
74
+ <artifactId>maven-install-plugin</artifactId>
75
+ <version>2.5.2</version>
76
+ </plugin>
77
+ <plugin>
78
+ <artifactId>maven-deploy-plugin</artifactId>
79
+ <version>2.8.2</version>
80
+ </plugin>
81
+ <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
82
+ <plugin>
83
+ <artifactId>maven-site-plugin</artifactId>
84
+ <version>3.7.1</version>
85
+ </plugin>
86
+ <plugin>
87
+ <artifactId>maven-project-info-reports-plugin</artifactId>
88
+ <version>3.0.0</version>
89
+ </plugin>
90
+ </plugins>
91
+ </pluginManagement>
92
+ </build>
93
+ </project>
94
+
95
+ ```
96
+
97
+ 【コード】
98
+ ```Java
99
+ package com.example;
100
+
101
+ /**
102
+ * Hello world!
103
+ *
104
+ */
105
+ public class App
106
+ {
107
+ public static void main( String[] args )
108
+ {
109
+ System.out.println( "Hello World!" );
110
+ }
111
+ }
112
+
113
+ ```
114
+
115
+
8
116
  ### 発生している問題・エラーメッセージ
9
117
 
10
118
  ```