前提・実現したいこと
mavenを使っているのですが、エラーメッセージに対してどのような対処をすればよいのか、
ご教示のほど宜しくお願い致します。
porn.xmlとtext.txtが同じ階層にあるディレクトリで、
下記コマンドを実行しました。
mvn exec:java -Dexec.args="text.txt"
Sample.javaは、コマンド実行位置から、相対的に下記にあり、
\src\main\java\net\test\Sample.java
Sample.javaファイル内で、下記が記述されています。
package net.test;
発生している問題・エラーメッセージ
mvn exec:java -Dexec.args="text.txt" [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]
pom.xml
<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.0</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.3</version> <executions> <execution> <goals> <goal>java</goal> </goals> </execution> </executions> <configuration> <mainClass>net.test.Sample</mainClass> </configuration> </plugin> </plugins> </build>
Sample.java
package net.test; public class Sample { public static void main(String[] args) { if (args.length != 1) { System.err.println("Invalid arguments."); System.exit(1); }