rus*_*ock 5 java netbeans maven
我正在尝试编译,mvn install但我收到此错误:
[错误]无法执行目标org.apache.maven.plugins:maven-compiler-plugin:2.0.2:项目测试时编译(default-compile):编译失败:编译失败:
pom.xml文件:
<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.mycompany</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>test</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.mycompany.test.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.25</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)
怎么解决?
您的问题很可能<scope>是依赖关系.在IDE内部时,所有范围都将添加到项目的构建路径中.但是,在运行时,mvn只将适当的作用域添加到javac命令的类路径中.例如,如果您有一个类/src/main/java从一个作用域的依赖项中导入一个类<scope>test</scope>,那么IDE将能够构建项目,但是mvn会以您遇到的方式失败.
| 归档时间: |
|
| 查看次数: |
42695 次 |
| 最近记录: |