eclipse 缺少org.apache.maven.plugins:maven编译器插件:jar:3.8.6的POM-不确定原因

23c0lvtd  于 2022-11-29  发布在  Eclipse
关注(0)|答案(3)|浏览(144)

我有下面的代码。
我正在尝试使用Maven为bukkit插件(Minecraft)创建一个**'pom.xml'*文件。
然而,这给我带来了错误:
*'缺少用于org.apache.maven.plugins:maven编译器插件:jar:3.8.6的POM'**。
我试过解决一些不同的问题,但都没有成功。
我会非常感激你的帮助!

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>newestfile.here</groupId>
  <artifactId>newestplugin</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>3.8.6</version>       
              <configuration>
                  <source>19</source>
                  <target>19</target>
              </configuration>   
        </plugin>
      </plugins>
    </pluginManagement>
toe95027

toe950271#

源代码和目标代码看起来不对,你确定它们不应该是1.8吗?这是我看到的唯一列出的数字。仔细检查一下,然后尝试运行mvn编译,看看是否没有修复它。

7xllpg7q

7xllpg7q2#

我将版本更改为3.10.1,目标更改为17,如下所示,代码成功运行:

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>newestfile.here</groupId>
  <artifactId>newestplugin</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>3.10.1</version>       
              <configuration>
                  <source>17</source>
                  <target>17</target>
              </configuration>   
        </plugin>
      </plugins>
    </pluginManagement>
</build>
   <repositories>
       <repository>
         <id>spigot-repo</id>
         <url>https://hub.spigotmc.org/nexus/content/repositories/public/</url>
       </repository>
   </repositories>
      <dependencies>
       <dependency>
           <groupId>org.spigotmc</groupId>
           <artifactId>spigot-api</artifactId>
           <version>1.16.5-R0.1-SNAPSHOT</version><!--change this value depending on the version or use LATEST-->
           <type>jar</type>
           <scope>provided</scope>
       </dependency>
   </dependencies>
</project>

非常感谢你的帮助!

ki0zmccv

ki0zmccv3#

maven-compiler-plugin没有3.8.6版本。您需要选择其他版本。以下是可用版本列表https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin

相关问题