Maven依赖库路径
Maven dependency lib path
我已经创建了示例 Maven 项目并且它按预期执行得很好,但是我想知道 JUnit 库的位置。
我试图在本地存储库和我的项目路径中找到它,但没有找到。
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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.maven.sample</groupId>
<artifactId>sampleproject</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>sampleproject</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Maven 版本:3.3.9.
该文件肯定在您的 Maven 缓存中,在 .m2/repository/junit/junit/3.8.1
文件夹中,注意模式:.m2/repository/<groupId>/<artifactId>/<version>
如果您真的想让 Maven 自动生成它,请使用 Maven Dependency Plugin and its build-classpath 目标。
从您项目的命令行 运行:
mvn dependency:build-classpath
作为构建输出的一部分,它将为所有已声明的依赖项生成一个路径列表,因此您将确定要查找的位置。
此外,您可以使用 mdep.outputFile
选项将其写入文件:
mvn dependency:build-classpath -Dmdep.outputFile=classpath.txt
我已经创建了示例 Maven 项目并且它按预期执行得很好,但是我想知道 JUnit 库的位置。
我试图在本地存储库和我的项目路径中找到它,但没有找到。
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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.maven.sample</groupId>
<artifactId>sampleproject</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>sampleproject</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Maven 版本:3.3.9.
该文件肯定在您的 Maven 缓存中,在 .m2/repository/junit/junit/3.8.1
文件夹中,注意模式:.m2/repository/<groupId>/<artifactId>/<version>
如果您真的想让 Maven 自动生成它,请使用 Maven Dependency Plugin and its build-classpath 目标。
从您项目的命令行 运行:
mvn dependency:build-classpath
作为构建输出的一部分,它将为所有已声明的依赖项生成一个路径列表,因此您将确定要查找的位置。
此外,您可以使用 mdep.outputFile
选项将其写入文件:
mvn dependency:build-classpath -Dmdep.outputFile=classpath.txt