我正在将java项目转换为maven.
我添加了这些依赖项
<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>Tippreports</groupId>
<artifactId>Tippreports</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<type>maven-plugin</type>
</dependency>
</dependencies>
</plugin>
<plugin>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.141.5</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
</dependencies>
</plugin>
<plugin>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<type>maven-plugin</type>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
添加依赖项后,我无法以Maven安装或构建的方式运行
错误是
Error resolving version for plugin 'org.apache.maven.plugins:null'
from the repositories [local (C:\Users\rck\.m2\repository),
central (http://repo.maven.apache.org/maven2)]:
Plugin not found in any plugin repository
Run Code Online (Sandbox Code Playgroud)
我应该在上面指定的位置创建一个文件夹,还是需要更改位置?
您的pom.xml对XSD无效.您应该首先使用可以向您显示问题的IDE.
正确的结构<build><plugins><plugin>如下例所示:
<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>Tippreports</groupId>
<artifactId>Tippreports</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.141.5</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
您还在混合使用依赖项的插件配置.依赖关系将转到pom.xml中的不同位置.
| 归档时间: |
|
| 查看次数: |
177 次 |
| 最近记录: |