我正在尝试从maven命令行运行一个类但是出现以下错误。不知道我错过了什么。有人可以指导吗?
命令
C:\my-samples\MavenCommandLine>mvn exec:java -Dexec:mainClass=com.study.maven.Main
错误-登录
[错误]无法在项目MavenCommandLine上执行目标org.codehaus.mojo:exec-maven-plugin:1.3.2:java(default-cli):目标org.codehaus.mojo的参数'mainClass':exec -maven-plugin:1.3.2:java缺失或无效 - > [帮助1]
Main.java
package com.study.maven;
public class Main {
public static void main(String[] args) {
System.out.println("Hello Maven!");
}
}
的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.study</groupId>
<artifactId>MavenCommandLine</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
</project>