problème concernant la class Javaplugin sur Eclipse

  • Auteur de la discussion Auteur de la discussion Mun
  • Date de début Date de début
Essaye de faire clique droit sur pom.xml > Run As > maven build ; le plugin devrait être généré dans target/.
 
je suis vraiment en difficulté pour le pom.xml pouvais vous me le refaire s'il vous plaît ?
 

Fichiers joints

  • image_2023-04-26_224512977.png
    image_2023-04-26_224512977.png
    27.5 KB · Vues : 49
XML:
<?xml version="1.0" encoding="UTF-8"?>
<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>fr.mun</groupId>
    <artifactId>myfirstplugin</artifactId>
    <version>1.0.0</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
  
<!--
   <build>
        <sourceDirectory>src</sourceDirectory>
       
        <resources>
            <resource>
                <directory>resources</directory>
            </resource>
        </resources>
   </build>
-->
  
   <repositories>
      <repository>
         <id>spigot-repo</id>
         <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
      </repository>
   </repositories>
  
   <dependencies>
      <dependency>
         <groupId>org.spigotmc</groupId>
         <artifactId>spigot-api</artifactId>
         <version>1.19.4-R0.1-SNAPSHOT</version>
         <scope>provided</scope>
      </dependency>
   </dependencies>
</project>
 
problème ça m'a réafficher un message:

[09:01:37] [Server thread/ERROR]: Could not load 'plugins\myplugin1.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:170) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:144) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R3.CraftServer.loadPlugins(CraftServer.java:423) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3739-Spigot-d1bd3bd-63cad7f]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:219) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3739-Spigot-d1bd3bd-63cad7f]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:975) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3739-Spigot-d1bd3bd-63cad7f]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3739-Spigot-d1bd3bd-63cad7f]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
... 7 more


ou alors ce message

[09:15:26] [Server thread/WARN]: Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!
[09:15:31] [Server thread/WARN]: Legacy plugin MyFirstPlugin v1.0 does not specify an api-version.
[09:15:31] [Server thread/ERROR]: Could not load 'plugins\myplug.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `fr.mun.myplugin'
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:69) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R3.CraftServer.loadPlugins(CraftServer.java:423) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3739-Spigot-d1bd3bd-63cad7f]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:219) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3739-Spigot-d1bd3bd-63cad7f]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:975) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3739-Spigot-d1bd3bd-63cad7f]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3739-Spigot-d1bd3bd-63cad7f]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.ClassNotFoundException: fr.mun.myplugin
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:147) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:467) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:67) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
... 8 more
 

Fichiers joints

  • image_2023-04-27_090448777.png
    image_2023-04-27_090448777.png
    30.1 KB · Vues : 40
  • image_2023-04-27_090531362.png
    image_2023-04-27_090531362.png
    6.1 KB · Vues : 42
  • image_2023-04-27_090922525.png
    image_2023-04-27_090922525.png
    70.3 KB · Vues : 43
  • image_2023-04-27_091120551.png
    image_2023-04-27_091120551.png
    42 KB · Vues : 41
  • image_2023-04-27_091136965.png
    image_2023-04-27_091136965.png
    5.3 KB · Vues : 43
  • image_2023-04-27_091321787.png
    image_2023-04-27_091321787.png
    47.8 KB · Vues : 47
Dernière édition:
Code:
[09:15:26] [Server thread/WARN]: Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!
[09:15:31] [Server thread/WARN]: Legacy plugin MyFirstPlugin v1.0 does not specify an api-version.
[09:15:31] [Server thread/ERROR]: Could not load 'plugins\myplug.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `fr.mun.myplugin'
Caused by: java.lang.ClassNotFoundException: fr.mun.myplugin

fr.mun.myplugin n'existe pas, tu dois mettre fr.mun.myfirstplugin.MyPlugin et renommer ta classe en PascalCase (MyPlugin au lieu de myplugin).

De plus, tu dois spécifier la version de ton plugin :
YAML:
main: fr.mun.myfirstplugin.MyPlugin
api-version: 1.19