0

I have the following code.

I am trying to create a 'pom.xml' file for a bukkit plugin (Minecraft) using Maven.

However, this gives me the error: 'The POM for org.apache.maven.plugins:maven-compiler-plugin:jar:3.8.6 is missing'.

I have tried to trouble shoot a few different solutions but haven't been successful in any.

I would be so grateful for a helping hand!

<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>
Caledonian26
  • 727
  • 1
  • 10
  • 27
  • [There is no `3.8.6` version of the `maven-compiler-plugin`](https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin). – Turing85 Nov 22 '22 at 21:01
  • Thanks so much - I changed it to 3.10.1 and lowered the target version to 17 (rather than 19) and both those things made the code work! :) – Caledonian26 Nov 22 '22 at 21:04

3 Answers3

0

The source and target look wrong, are you sure they shouldn't be 1.8? That is the only number I see listed. Double check that and try running mvn compile and see if that didn't fix it.

Ian
  • 15
  • 1
  • 7
  • 1
    Java 1.8 was released in 2014. The last LTS is Java 17. The last release is Java 19. – Turing85 Nov 22 '22 at 21:06
  • Thanks so much - I have now solved the issue - I changed the version and target :)! (see below) – Caledonian26 Nov 22 '22 at 21:06
  • Didn't realize that was referring to the JDK, makes sense. I try to stay out of our POM if I can. Also since I can't comment on the below. Version 17 is the LTS version, so I would recommend sticking with 17 over 18 or 19. – Ian Nov 22 '22 at 21:23
0

I changed the version to 3.10.1 and the target to 17 as follows, and the code successfully ran:

<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>

Thanks so much for all your help!

Caledonian26
  • 727
  • 1
  • 10
  • 27
  • Are you sure yo need to downgrade `` and `` to `17`? It should work if you set `19` instead of `` and `` (taken from [this answer](https://stackoverflow.com/a/73264624/4216641) by [Basil Bourque](https://stackoverflow.com/users/642706/basil-bourque)) – Turing85 Nov 22 '22 at 21:10
  • Does it make a significant difference? :) – Caledonian26 Nov 22 '22 at 22:29
  • [I would say so](https://www.infoworld.com/article/3630510/jdk-18-the-new-features-in-java-18.html), [yes](https://www.infoworld.com/article/3653331/jdk-19-the-new-features-in-java-19.html). – Turing85 Nov 22 '22 at 22:31
0

maven-compiler-plugin doesn't have 3.8.6 version. You need to choose some other version. Here is the available version list https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin.

aatwork
  • 2,130
  • 4
  • 17