質問編集履歴

3

javaの内容等の追記

2018/12/18 02:25

投稿

150be
150be

スコア20

test CHANGED
File without changes
test CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
 
4
4
 
5
- JavaによるSpringBootの開発段階での質問です。
5
+ SpringBootの開発段階での質問です。
6
6
 
7
7
 
8
8
 
9
9
  【現状】
10
10
 
11
- STSをインストールして、Mavenベースのプロジェクト作成からビルドが行えない状態です
11
+ STSをインストールして、Mavenベースのプロジェクト作成からビルドが行えません
12
12
 
13
13
 
14
14
 
@@ -26,67 +26,25 @@
26
26
 
27
27
  ### 発生している問題・エラーメッセージ
28
28
 
29
-
30
-
31
- ```
29
+ ```Error
32
30
 
33
31
  [INFO] Scanning for projects...
34
32
 
35
- [WARNING]
36
-
37
- [WARNING] Some problems were encountered while building the effective model for com.tuyano.springboot:MyBootApp:jar:0.0.1-SNAPSHOT
38
-
39
- [WARNING] 'dependencies.dependency.type' for org.springframework.boot:spring-boot-starter-web:jar must be 'pom' to import the managed dependencies. @ line 29, column 15
40
-
41
- [WARNING] 'dependencies.dependency.type' for org.springframework.boot:spring-boot-starter-test:jar must be 'pom' to import the managed dependencies. @ line 35, column 15
42
-
43
- [WARNING] 'dependencyManagement.dependencies.dependency.type' for org.springframework.boot:spring-boot-starter-parent:jar must be 'pom' to import the managed dependencies. @ line 19, column 16
44
-
45
- [WARNING] 'build.plugins.plugin.version' for org.springframework.boot:spring-boot-maven-plugin is missing. @ line 54, column 15
46
-
47
- [WARNING] 'dependencies.dependency.scope' for org.springframework.boot:spring-boot-starter-web:jar must be one of [provided, compile, runtime, test, system] but is 'import'. @ line 33, column 11
48
-
49
- [WARNING] 'dependencies.dependency.scope' for org.springframework.boot:spring-boot-starter-test:jar must be one of [provided, compile, runtime, test, system] but is 'import'. @ line 39, column 11
50
-
51
- [WARNING]
52
-
53
- [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
54
-
55
- [WARNING]
56
-
57
- [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
58
-
59
- [WARNING]
60
-
61
- [INFO]
62
-
63
- [INFO] ------------------------------------------------------------------------
64
-
65
- [INFO] Building MyBootApp 0.0.1-SNAPSHOT
66
-
67
- [INFO] ------------------------------------------------------------------------
68
-
69
- [INFO] Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-maven-plugin/maven-metadata.xml
70
-
71
- [WARNING] Could not transfer metadata org.springframework.boot:spring-boot-maven-plugin/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Failed to connect to /××.×××.×××.×:×××
72
-
73
- [INFO] ------------------------------------------------------------------------
74
-
75
- [INFO] BUILD FAILURE
76
-
77
- [INFO] ------------------------------------------------------------------------
78
-
79
- [INFO] Total time: 1.725 s
80
-
81
- [INFO] Finished at: 2018-12-14T15:00:42+09:00
82
-
83
- [INFO] Final Memory: 8M/77M
84
-
85
- [INFO] ------------------------------------------------------------------------
86
-
87
- [WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
88
-
89
- [ERROR] Error resolving version for plugin 'org.springframework.boot:spring-boot-maven-plugin' from the repositories [local (C:\Users\××××.m2\repository), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository -> [Help 1]
33
+ [INFO] Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.1.1.RELEASE/spring-boot-starter-parent-2.1.1.RELEASE.pom
34
+
35
+ [ERROR] [ERROR] Some problems were encountered while processing the POMs:
36
+
37
+ [FATAL] Non-resolvable parent POM for com.tuyano.springboot:MyBootApp:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.1.RELEASE from/to central (https://repo.maven.apache.org/maven2): Unexpected response code for CONNECT: 405 and 'parent.relativePath' points at no local POM @ line 16, column 13
38
+
39
+ @
40
+
41
+ [ERROR] The build could not read 1 project -> [Help 1]
42
+
43
+ [ERROR]
44
+
45
+ [ERROR] The project com.tuyano.springboot:MyBootApp:0.0.1-SNAPSHOT (C:\Users\×××××\Documents\workspace-sts-3.9.2.RELEASE\MyBootApp\pom.xml) has 1 error
46
+
47
+ [ERROR] Non-resolvable parent POM for com.tuyano.springboot:MyBootApp:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.1.RELEASE from/to central (https://repo.maven.apache.org/maven2): Unexpected response code for CONNECT: 405 and 'parent.relativePath' points at no local POM @ line 16, column 13 -> [Help 2]
90
48
 
91
49
  [ERROR]
92
50
 
@@ -98,16 +56,14 @@
98
56
 
99
57
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
100
58
 
101
- [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginVersionResolutionException
59
+ [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
60
+
102
-
61
+ [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
62
+
103
- ```
63
+ ```
104
-
105
-
106
64
 
107
65
  ### 該当のソースコード
108
66
 
109
-
110
-
111
67
  ```pom.xml
112
68
 
113
69
  <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -240,11 +196,7 @@
240
196
 
241
197
  ```
242
198
 
243
-
244
-
245
- ### 変更後のpom.xmlとエラー内容
199
+ ### 変更後のpom.xml 等
246
-
247
-
248
200
 
249
201
  ```pom
250
202
 
@@ -358,50 +310,70 @@
358
310
 
359
311
  ```
360
312
 
361
-
362
-
363
- ```Error
364
-
365
- [INFO] Scanning for projects...
366
-
367
- [INFO] Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.1.1.RELEASE/spring-boot-starter-parent-2.1.1.RELEASE.pom
368
-
369
- [ERROR] [ERROR] Some problems were encountered while processing the POMs:
370
-
371
- [FATAL] Non-resolvable parent POM for com.tuyano.springboot:MyBootApp:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.1.RELEASE from/to central (https://repo.maven.apache.org/maven2): Unexpected response code for CONNECT: 405 and 'parent.relativePath' points at no local POM @ line 16, column 13
372
-
373
- @
374
-
375
- [ERROR] The build could not read 1 project -> [Help 1]
376
-
377
- [ERROR]
378
-
379
- [ERROR] The project com.tuyano.springboot:MyBootApp:0.0.1-SNAPSHOT (C:\Users\×××××\Documents\workspace-sts-3.9.2.RELEASE\MyBootApp\pom.xml) has 1 error
380
-
381
- [ERROR] Non-resolvable parent POM for com.tuyano.springboot:MyBootApp:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.1.RELEASE from/to central (https://repo.maven.apache.org/maven2): Unexpected response code for CONNECT: 405 and 'parent.relativePath' points at no local POM @ line 16, column 13 -> [Help 2]
382
-
383
- [ERROR]
384
-
385
- [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
386
-
387
- [ERROR] Re-run Maven using the -X switch to enable full debug logging.
388
-
389
- [ERROR]
390
-
391
- [ERROR] For more information about the errors and possible solutions, please read the following articles:
392
-
393
- [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
394
-
395
- [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
396
-
397
- ```
398
-
399
-
313
+ ```MyBootAppApplication
314
+
315
+ package com.tuyano.springboot;
316
+
317
+
318
+
319
+ import org.springframework.boot.SpringApplication;
320
+
321
+ import org.springframework.boot.autoconfigure.SpringBootApplication;
322
+
323
+ import org.springframework.boot.SpringApplication;
324
+
325
+ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
326
+
327
+ import org.springframework.web.bind.annotation.RequestMapping;
328
+
329
+ import org.springframework.web.bind.annotation.RestController;
330
+
331
+
332
+
333
+ @RestController
334
+
335
+ @EnableAutoConfiguration
336
+
337
+ @SpringBootApplication
338
+
339
+ public class MyBootAppApplication {
340
+
341
+
342
+
343
+ @RequestMapping("/")
344
+
345
+ String home(){
346
+
347
+ return "Hello World !";
348
+
349
+ }
350
+
351
+
352
+
353
+ public static void main(String[] args) {
354
+
355
+ SpringApplication.run(MyBootAppApplication.class, args);
356
+
357
+ }
358
+
359
+ }
360
+
361
+ ```
362
+
363
+ ```applicationproperties
364
+
365
+ spring.application.name=cruncher
366
+
367
+ spring.datasource.driverClassName=com.mysql.jdbc.Driver
368
+
369
+ spring.datasource.url=jdbc:mysql://localhost/test
370
+
371
+ server.port=×××
372
+
373
+ ```
400
374
 
401
375
  ### 試したこと
402
376
 
403
-
404
-
405
377
  ・Maven > Update project → Run as > Maven cleanを実行。(Maven cleanで既に上記のエラーが出る)
406
378
 
407
379
  ・STSのバージョンを最新のものにして実行。

2

ソース内容に少し誤りがありました。

2018/12/18 02:25

投稿

150be
150be

スコア20

test CHANGED
File without changes
test CHANGED
@@ -376,7 +376,7 @@
376
376
 
377
377
  [ERROR]
378
378
 
379
- [ERROR] The project com.tuyano.springboot:MyBootApp:0.0.1-SNAPSHOT (C:\Users\N0103977\Documents\workspace-sts-3.9.2.RELEASE\MyBootApp\pom.xml) has 1 error
379
+ [ERROR] The project com.tuyano.springboot:MyBootApp:0.0.1-SNAPSHOT (C:\Users\×××××\Documents\workspace-sts-3.9.2.RELEASE\MyBootApp\pom.xml) has 1 error
380
380
 
381
381
  [ERROR] Non-resolvable parent POM for com.tuyano.springboot:MyBootApp:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.1.RELEASE from/to central (https://repo.maven.apache.org/maven2): Unexpected response code for CONNECT: 405 and 'parent.relativePath' points at no local POM @ line 16, column 13 -> [Help 2]
382
382
 

1

頂いた回答を基に修正したpom.xmlと結果のエラー内容の追記

2018/12/18 00:19

投稿

150be
150be

スコア20

test CHANGED
File without changes
test CHANGED
@@ -242,6 +242,162 @@
242
242
 
243
243
 
244
244
 
245
+ ### 変更後のpom.xmlとエラー内容
246
+
247
+
248
+
249
+ ```pom
250
+
251
+ <?xml version="1.0" encoding="UTF-8"?>
252
+
253
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
254
+
255
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
256
+
257
+ <modelVersion>4.0.0</modelVersion>
258
+
259
+
260
+
261
+ <groupId>com.tuyano.springboot</groupId>
262
+
263
+ <artifactId>MyBootApp</artifactId>
264
+
265
+ <version>0.0.1-SNAPSHOT</version>
266
+
267
+ <name>MyBootApp</name>
268
+
269
+ <description>Sample project for Spring Boot</description>
270
+
271
+
272
+
273
+ <properties>
274
+
275
+ <java.version>1.8</java.version>
276
+
277
+ </properties>
278
+
279
+
280
+
281
+ <parent>
282
+
283
+ <groupId>org.springframework.boot</groupId>
284
+
285
+ <artifactId>spring-boot-starter-parent</artifactId>
286
+
287
+ <version>2.1.1.RELEASE</version>
288
+
289
+ <relativePath/> <!-- lookup parent from repository -->
290
+
291
+ </parent>
292
+
293
+
294
+
295
+ <dependencies>
296
+
297
+ <dependency>
298
+
299
+ <groupId>org.springframework.boot</groupId>
300
+
301
+ <artifactId>spring-boot-starter-web</artifactId>
302
+
303
+ </dependency>
304
+
305
+
306
+
307
+ <dependency>
308
+
309
+ <groupId>org.springframework.boot</groupId>
310
+
311
+ <artifactId>spring-boot-starter-test</artifactId>
312
+
313
+ <scope>test</scope>
314
+
315
+ </dependency>
316
+
317
+ </dependencies>
318
+
319
+
320
+
321
+ <profiles><!-- プロファイルを設定する -->
322
+
323
+ <profile>
324
+
325
+ <id>product</id>
326
+
327
+ <properties>
328
+
329
+ <mykey>productvalue</mykey>
330
+
331
+ </properties>
332
+
333
+ </profile>
334
+
335
+ </profiles>
336
+
337
+
338
+
339
+ <build>
340
+
341
+ <plugins>
342
+
343
+ <plugin>
344
+
345
+ <groupId>org.springframework.boot</groupId>
346
+
347
+ <artifactId>spring-boot-maven-plugin</artifactId>
348
+
349
+ </plugin>
350
+
351
+ </plugins>
352
+
353
+ </build>
354
+
355
+
356
+
357
+ </project>
358
+
359
+ ```
360
+
361
+
362
+
363
+ ```Error
364
+
365
+ [INFO] Scanning for projects...
366
+
367
+ [INFO] Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.1.1.RELEASE/spring-boot-starter-parent-2.1.1.RELEASE.pom
368
+
369
+ [ERROR] [ERROR] Some problems were encountered while processing the POMs:
370
+
371
+ [FATAL] Non-resolvable parent POM for com.tuyano.springboot:MyBootApp:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.1.RELEASE from/to central (https://repo.maven.apache.org/maven2): Unexpected response code for CONNECT: 405 and 'parent.relativePath' points at no local POM @ line 16, column 13
372
+
373
+ @
374
+
375
+ [ERROR] The build could not read 1 project -> [Help 1]
376
+
377
+ [ERROR]
378
+
379
+ [ERROR] The project com.tuyano.springboot:MyBootApp:0.0.1-SNAPSHOT (C:\Users\N0103977\Documents\workspace-sts-3.9.2.RELEASE\MyBootApp\pom.xml) has 1 error
380
+
381
+ [ERROR] Non-resolvable parent POM for com.tuyano.springboot:MyBootApp:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.1.RELEASE from/to central (https://repo.maven.apache.org/maven2): Unexpected response code for CONNECT: 405 and 'parent.relativePath' points at no local POM @ line 16, column 13 -> [Help 2]
382
+
383
+ [ERROR]
384
+
385
+ [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
386
+
387
+ [ERROR] Re-run Maven using the -X switch to enable full debug logging.
388
+
389
+ [ERROR]
390
+
391
+ [ERROR] For more information about the errors and possible solutions, please read the following articles:
392
+
393
+ [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
394
+
395
+ [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
396
+
397
+ ```
398
+
399
+
400
+
245
401
  ### 試したこと
246
402
 
247
403