質問編集履歴

6

修正

2018/04/06 08:51

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -44,7 +44,7 @@
44
44
 
45
45
 
46
46
 
47
- porn.xml
47
+ pom.xml
48
48
 
49
49
  ```
50
50
 

5

修正

2018/04/06 08:51

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -8,9 +8,9 @@
8
8
 
9
9
 
10
10
 
11
- porn.xmlとtext.txtが格納されているディレクトリで、
11
+ porn.xmlとtext.txtが同じ階層にあるディレクトリで、
12
12
 
13
- 下記を実行しました。
13
+ 下記コマンドを実行しました。
14
14
 
15
15
  ```
16
16
 

4

修正

2018/04/05 07:38

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- porn.xmlとtext.testが格納されているディレクトリで、
11
+ porn.xmlとtext.txtが格納されているディレクトリで、
12
12
 
13
13
  下記を実行しました。
14
14
 

3

修正

2018/04/05 07:37

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -113,3 +113,29 @@
113
113
  </build>
114
114
 
115
115
  ```
116
+
117
+
118
+
119
+ Sample.java
120
+
121
+ ```
122
+
123
+ package net.test;
124
+
125
+
126
+
127
+ public class Sample {
128
+
129
+
130
+
131
+ public static void main(String[] args) {
132
+
133
+ if (args.length != 1) {
134
+
135
+ System.err.println("Invalid arguments.");
136
+
137
+ System.exit(1);
138
+
139
+ }
140
+
141
+ ```

2

修正

2018/04/05 07:35

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  ```
20
20
 
21
- Sample.javaは、下記にあり、
21
+ Sample.javaは、コマンド実行位置から、相対的に下記にあり、
22
22
 
23
23
  \src\main\java\net\test\Sample.java
24
24
 

1

追記

2018/04/05 07:33

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -5,6 +5,26 @@
5
5
  mavenを使っているのですが、エラーメッセージに対してどのような対処をすればよいのか、
6
6
 
7
7
  ご教示のほど宜しくお願い致します。
8
+
9
+
10
+
11
+ porn.xmlとtext.testが格納されているディレクトリで、
12
+
13
+ 下記を実行しました。
14
+
15
+ ```
16
+
17
+ mvn exec:java -Dexec.args="text.txt"
18
+
19
+ ```
20
+
21
+ Sample.javaは、下記にあり、
22
+
23
+ \src\main\java\net\test\Sample.java
24
+
25
+ Sample.javaファイル内で、下記が記述されています。
26
+
27
+ package net.test;
8
28
 
9
29
 
10
30
 
@@ -21,3 +41,75 @@
21
41
  [ERROR] Unknown lifecycle phase ".args=text.txt". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
22
42
 
23
43
  ```
44
+
45
+
46
+
47
+ porn.xml
48
+
49
+ ```
50
+
51
+ <properties>
52
+
53
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
54
+
55
+ </properties>
56
+
57
+
58
+
59
+ <build>
60
+
61
+ <plugins>
62
+
63
+ <plugin>
64
+
65
+ <groupId>org.apache.maven.plugins</groupId>
66
+
67
+ <artifactId>maven-compiler-plugin</artifactId>
68
+
69
+ <version>3.6.0</version>
70
+
71
+ <configuration>
72
+
73
+ <source>1.7</source>
74
+
75
+ <target>1.7</target>
76
+
77
+ </configuration>
78
+
79
+ </plugin>
80
+
81
+ <plugin>
82
+
83
+ <groupId>org.codehaus.mojo</groupId>
84
+
85
+ <artifactId>exec-maven-plugin</artifactId>
86
+
87
+ <version>1.3</version>
88
+
89
+ <executions>
90
+
91
+ <execution>
92
+
93
+ <goals>
94
+
95
+ <goal>java</goal>
96
+
97
+ </goals>
98
+
99
+ </execution>
100
+
101
+ </executions>
102
+
103
+ <configuration>
104
+
105
+ <mainClass>net.test.Sample</mainClass>
106
+
107
+ </configuration>
108
+
109
+ </plugin>
110
+
111
+ </plugins>
112
+
113
+ </build>
114
+
115
+ ```