#So how exactly do I do this. Do I just put a file path in the dependency section of gradle?
1 messages · Page 1 of 1 (latest)
nice it went into the thread name whoops
You see that paper api in your gradle
yes
You will replace that with a spigot one
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Read this ^
Choose the spigot one
Ok my build.gradle is updated, but now how do I get eclipse to recognize it? Is there hotkey or command to get it to build with gradle?
Oh I just clicked "refresh gradle build" but I get a gradle error that says "The supplied phased action failed with an exception".
in my build.gradle file
Need the full error
A problem occurred configuring root project 'cudcore'.
A problem occurred evaluating root project 'cudcore'.
Could not find method compileOnIy() for arguments .18-RO.I -SNAPSHOT] on object of type org.gradIe.api.internaI.artifacts.dsI.dependencies.DefauItDependencyHandIer.```
Could you send your build.gradle in a paste
Same error
Did you let BuildTools finish installing
show your build.gradle file
I sent it in a pastebin
The new one
I just added a .1 for 1.18.1
Yeah that should be fine
Im probably missing a key step
(gradle sucks anyway 😛 )
for maven you just have to run buildtools, then you're done
don't I need a pom.xml file for maven
yes, pom.xml = build.gradle
Should be the same for gradle
Gradle uses maven dependencies
yes, but then why isn't it working= :/
I have no idea
Should I run buildtools again with the new build.gradle?
no
does buildtools need to be in the same directory as my project?
how does gradle find the buildtools files then
Check if it's there
yeah it should be at org/spigotmc/spigot/
yeah its there
What’s up
oh no I was wrong
it's not working lol
Cant get gradle to work
they built spigot but gradle can't find it
Just do it?
02vala first of all you probably want to add mavenCentral() to your repositories block
If you depend on api that is
but why?
it's in the local repo
not on maven central
Oh I thought they wanted to depend on the api
aight
Yeah well just declaring it should be fine then
Or what does the error say?
If you get any that is
A problem occurred configuring root project 'cudcore'.
A problem occurred evaluating root project 'cudcore'.
Could not find method compileOnIy() for arguments .18-RO.I -SNAPSHOT] on object of type org.gradIe.api.internaI.artifacts.dsI.dependencies.DefauItDependencyHandIer.```
repositories {
maven {
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
// As of Gradle 5.1, you can limit this to only those
// dependencies you expect from it
content {
includeGroup 'org.bukkit'
includeGroup 'org.spigotmc'
}
}
/*
As Spigot-API depends on the Bungeecord ChatComponent-API,
we need to add the Sonatype OSS repository, as Gradle,
in comparison to maven, doesn't want to understand the ~/.m2
directory unless added using mavenLocal(). Maven usually just gets
it from there, as most people have run the BuildTools at least once.
This is therefore not needed if you're using the full Spigot/CraftBukkit,
or if you're using the Bukkit API.
*/
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
mavenLocal() // This is needed for CraftBukkit and Spigot.
}
dependencies {
// Pick only one of these and read the comment in the repositories block.
// compileOnly 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT' // The Spigot API with no shadowing. Requires the OSS repo.
// compileOnly 'org.bukkit:bukkit:1.18-R0.1-SNAPSHOT' // The Bukkit API with no shadowing.
compileOnly 'org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT' // The full Spigot server with no shadowing. Requires mavenLocal.
// compileOnly 'org.bukkit:craftbukkit:1.18-R0.1-SNAPSHOT' // The full CraftBukkit server with no shadowing. Requires mavenLocal.
}```
You need to add the java gradle plugin
so on top of that
Add
plugins {
id 'java'
}
What NMS import are you trying
import org.bukkit.craftbukkit.v1_18_R0_1.inventory.CraftItemStack;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.nbt.MojangsonParser;
import net.minecraft.nbt.NBTTagCompound;```
what does that mean
also, I can't build my jar, get this error:
src/me/cudos/cudcore [in cudcore] is not on its project's build path
Unable to get package fragment root: cudcore/src/me/cudos/cudcore/Cudcore.java
src/me/cudos/cudcore [in cudcore] is not on its project's build path
src/me/cudos/cudcore/utils [in cudcore] is not on its project's build path
Unable to get package fragment root: cudcore/src/me/cudos/cudcore/utils/Utils.java
src/me/cudos/cudcore/utils [in cudcore] is not on its project's build path
remapped = "official" mojang names for classes etc
Method names will be b() a() etc
ah like the obfuscated ones
Yeah
So how is it that i was able to use these before
and is there a way to continue using these
You can continue using them just find the new names for stuff
No i mean How can i use the unmapped names
Like I was before
Or if you're not sure for that how can I get the jar to build lol
If gradle loads correctly it means it works
You will just have to adjust your imports to whatever they are named in unmapped
How can I get the jar to build tho
Are you talking about these errors
yes
@queen fjord might you know?
Your java classes should be in the directory src/main/java
Where should plugin.yml be
src/main/resources
new errors:
https://paste.md-5.net/ecayajehex.coffeescript
The entire one
How do you create your jar?
You probably want to run the gradle task jar
How do I
I don’t know haven’t used eclipse in ages
ok so I found the task view
and then i clicked jar
I get some red exclamation points
but where is the file output
this is the error message
Try using build instead of jar
Can you paste the error?
Tho it looks like you got yourself a syntax error somewhere without having seen the error
It's a giant gradle error
It doesn't say what's wrong with the code
@lean oracle are you using anything else than spigot
Make sure you haven't imported any jars directly
Are you using it in the code
yes
How do I reference an external jar such as votifier in the build.gradle
compile files('libs/something_local.jar')?
will that look in the project root for a libs folder?
No that doesnt work I get a could not find method compile for arguments [file collection] error
Don't reference jars
You need to find the dependency information
Simillar to what spigot looks like
would a gh repo work
Are you using normal votifier or one if it's forks
Yes and no
Scroll down and click developer information
Then look at that
ahh
maven {
url 'https://jitpack.io'
}
...
}
...
dependencies {
compileOnly "com.vexsoftware:nuvotifier-universal:version"
...
}```
Now take the important parts from that and move it in to your build file
Gradle had many ways of doing the same thing
Ah
and then just insert the actual verison number instead of the text version, right?
compileOnly 'com.vexsoftware:nuvotifier-universal:2.7.3'
Yeah
now how do I do the same for something like armorequipevent which does not provide the repo/gradle info
ArmorEquipEvent is archived and outdated
If you still want to you can use a website called jitpack
It turns github projects in to maven and gradle repos
Go to jitpack.io
Then paste link to github page
oh woah
nice
do I do implementation 'com.github.Arnuh:ArmorEquipEvent:1.7.6' or compileOnly
Click get on the latest version. Select gradle and move that info in to your file
You want implementation
Now if it throws an error when you try to use the plugin
It means that file isn't on the server
To solve this you need to put it in to your jar
Moving it in to your jar from a dependency is called shading
To do so with gradle you use the shadow plugin
Here is it's user guide https://imperceptiblethoughts.com/shadow/getting-started/#default-java-groovy-tasks
Ok interesting
can I remove the jre system library from my classpath now that I am using gradle?
because It throws an error when I have it in there
Yeah if you want
I mean maybe
The project will still compile with gradle but eclipse might give warnings
Try it
now it says cannot be built because path is incomplete
when I use gradle build jar
I still get some errors
Could you give full error
You can add a directory as a repo
Did you add the jitpack repo
Moreover you should also add shadowJar plugin given that you use implementation
yes
Could you send your build.gradle
Actually it's failing to find nuvotifier
Ah you missed the nuvotifier repo
Ah they're also using jitpack
Open the jitpack page and do the same way as you did with the armor event page
Just so you get the right version info
Yeah
Thank you for all your help Olivo but I still get the build error. It seems like its a problem with eclipse having the jdk in the build path but all the dependencies are managed by gradle. when I refresh the build path, the jdk error message goes away but I get an error for all of my dependencies such as bukkit, etc. But when I refresh gradle, all the dependency errors go away but my JRE error message comes back and says the system jdk is unbound
Thats what shows up when I refresh gradle
and heres what shows up if I refresh the project build path
it just seems to stop recognizing all the dependencies
@queen fjord
Send the build file
plugins {
id 'java'
}
repositories {
maven {
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
url 'https://jitpack.io'
// As of Gradle 5.1, you can limit this to only those
// dependencies you expect from it
content {
includeGroup 'org.bukkit'
includeGroup 'org.spigotmc'
}
}
/*
As Spigot-API depends on the Bungeecord ChatComponent-API,
we need to add the Sonatype OSS repository, as Gradle,
in comparison to maven, doesn't want to understand the ~/.m2
directory unless added using mavenLocal(). Maven usually just gets
it from there, as most people have run the BuildTools at least once.
This is therefore not needed if you're using the full Spigot/CraftBukkit,
or if you're using the Bukkit API.
*/
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
mavenLocal() // This is needed for CraftBukkit and Spigot.
}
dependencies {
// Pick only one of these and read the comment in the repositories block.
// compileOnly 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT' // The Spigot API with no shadowing. Requires the OSS repo.
// compileOnly 'org.bukkit:bukkit:1.18-R0.1-SNAPSHOT' // The Bukkit API with no shadowing.
compileOnly 'org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT' // The full Spigot server with no shadowing. Requires mavenLocal.
// compileOnly 'org.bukkit:craftbukkit:1.18-R0.1-SNAPSHOT' // The full CraftBukkit server with no shadowing. Requires mavenLocal.
implementation 'com.github.NuVotifier.NuVotifier:nuvotifier-api:2.7.2'
implementation 'com.github.Arnuh:ArmorEquipEvent:1.7.6'
}```
@queen fjord
Fix these errors first btw
Are those not fixed by the gradle imports?
no they look like they are import issues. For example it is not recognizing the methods available in mojangsonparser
Methods change from version to version
Make sure they still exist
where can I check if they exist. is there a javadoc for nms stuff?