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

lean oracle
shy dome
#

No

#

Not a file path

lean oracle
#

nice it went into the thread name whoops

shy dome
#

You see that paper api in your gradle

lean oracle
#

yes

shy dome
#

You will replace that with a spigot one

#

Read this ^

#

Choose the spigot one

lean oracle
#

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?

shy dome
#

I don't use Eclipse

#

So uh try google it

lean oracle
#

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

shy dome
#

Need the full error

lean oracle
#
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.```
shy dome
#

Could you send your build.gradle in a paste

lean oracle
#

1 sec

shy dome
#

Did you build 1.18.1 with BuildTools

#

If so set the dependency to 1.18.1

lean oracle
#

Same error

shy dome
#

Did you let BuildTools finish installing

lean oracle
#

I sent it in a pastebin

shy dome
#

The new one

lean oracle
shadow tundra
#

hm strange

#

sorry I can't help, I have no idea about gradle

lean oracle
#

I just added a .1 for 1.18.1

shy dome
#

Yeah that should be fine

lean oracle
#

Im probably missing a key step

shadow tundra
#

(gradle sucks anyway 😛 )

#

for maven you just have to run buildtools, then you're done

lean oracle
#

don't I need a pom.xml file for maven

shadow tundra
#

yes, pom.xml = build.gradle

shy dome
#

Gradle uses maven dependencies

shadow tundra
shy dome
#

I have no idea

lean oracle
#

Should I run buildtools again with the new build.gradle?

lean oracle
#

does buildtools need to be in the same directory as my project?

shadow tundra
#

no

#

doesn't matter where your buildtools is

lean oracle
#

how does gradle find the buildtools files then

shadow tundra
#

buildtools copies it to your local maven repo

#

at C:\Users\yourName\.m2\repository

shy dome
#

Check if it's there

shadow tundra
#

yeah it should be at org/spigotmc/spigot/

lean oracle
#

yeah its there

shadow tundra
#

show a screenshot pls

#

can't hurt to double check it 🙂

lean oracle
#

\.m2\repository\org\spigotmc\spigot\1.18.1-R0.1-SNAPSHOT this path exists

shadow tundra
#

and what's inside?

#

yeah looks correct

#

I have no idea then

#

oh wait

#

wait

queen fjord
#

What’s up

shadow tundra
#

oh no I was wrong

shadow tundra
lean oracle
shadow tundra
#

they built spigot but gradle can't find it

jaunty grove
#

Just do it?

queen fjord
#

02vala first of all you probably want to add mavenCentral() to your repositories block

#

If you depend on api that is

lean oracle
#

i need spigot, bukkit, and nms

#

just like this?

shadow tundra
#

it's in the local repo

#

not on maven central

queen fjord
#

Oh I thought they wanted to depend on the api

shadow tundra
#

no, spigot itself

#

NMS etc

queen fjord
#

aight

#

Yeah well just declaring it should be fine then

#

Or what does the error say?

#

If you get any that is

lean oracle
#
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.```
queen fjord
#

Send your entire build.gradle

#

Not just the deps

lean oracle
#
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.
}```
queen fjord
#

You need to add the java gradle plugin

#

so on top of that

#

Add
plugins {
id 'java'
}

lean oracle
#

at the end?

#

or the top of the file

queen fjord
#

Read what I said

#

so on top of that

lean oracle
#

Ok so that worked it built

#

but I am still unable to use the nms imports

shy dome
#

What NMS import are you trying

lean oracle
#
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;```
shy dome
#

That won't work

#

Actually nvm

#

You're using unmapped

lean oracle
#

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
shadow tundra
shy dome
#

Method names will be b() a() etc

lean oracle
#

ah like the obfuscated ones

shy dome
#

Yeah

lean oracle
#

So how is it that i was able to use these before

#

and is there a way to continue using these

shy dome
#

You can continue using them just find the new names for stuff

lean oracle
#

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

shy dome
#

If gradle loads correctly it means it works

#

You will just have to adjust your imports to whatever they are named in unmapped

lean oracle
#

How can I get the jar to build tho

shy dome
lean oracle
#

yes

shy dome
#

I have no idea

#

Never seen them before

lean oracle
#

@queen fjord might you know?

queen fjord
#

Your java classes should be in the directory src/main/java

lean oracle
#

Where should plugin.yml be

queen fjord
#

src/main/resources

lean oracle
queen fjord
#

Can you send a screenshot of the project tree

#

Or push to sth like gh

lean oracle
queen fjord
#

The entire one

lean oracle
#

do u need to see inside of gradle and bin as well

queen fjord
#

How do you create your jar?

lean oracle
#

Eclipse > Export

#

build as jar

queen fjord
#

You probably want to run the gradle task jar

lean oracle
#

How do I

queen fjord
#

I don’t know haven’t used eclipse in ages

lean oracle
#

ok so I found the task view

#

and then i clicked jar

#

I get some red exclamation points

#

but where is the file output

shy dome
#

It failed compile so there is none

#

It will be in builds/libs

lean oracle
shy dome
#

Try using build instead of jar

queen fjord
#

Can you paste the error?

#

Tho it looks like you got yourself a syntax error somewhere without having seen the error

shy dome
#

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

lean oracle
#

wait I am

#

Im using votifier

#

and one other external library

#

@shy dome

shy dome
#

Are you using it in the code

lean oracle
#

yes

shy dome
#

That's why it won't compile

#

You need to add votifier to your build.gradle

lean oracle
#

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

shy dome
#

Don't reference jars

#

You need to find the dependency information

#

Simillar to what spigot looks like

lean oracle
#

but I dont have it in my local maven repo

#

I only have it as a jar file

shy dome
#

You're not going to use the local one this time

#

Find the online repo for it

lean oracle
#

would a gh repo work

shy dome
#

Are you using normal votifier or one if it's forks

lean oracle
#

im using the normal nuvotifier

#

thats for my other dependency

shy dome
lean oracle
shy dome
#

Then look at that

lean oracle
#

ahh

#
    maven {
        url 'https://jitpack.io'
    }
    ...
}
...
dependencies {
    compileOnly "com.vexsoftware:nuvotifier-universal:version"
    ...
}```
shy dome
#

Now take the important parts from that and move it in to your build file

lean oracle
#

do I do url = or just url

#

because the spigotmc one uses url =

shy dome
#

Gradle had many ways of doing the same thing

lean oracle
#

Ah

#

and then just insert the actual verison number instead of the text version, right?

#

compileOnly 'com.vexsoftware:nuvotifier-universal:2.7.3'

shy dome
#

Yeah

lean oracle
#

now how do I do the same for something like armorequipevent which does not provide the repo/gradle info

shy dome
#

ArmorEquipEvent is archived and outdated

lean oracle
#

yes but I still use it

#

and it works fine, even on 1.18

shy dome
#

If you still want to you can use a website called jitpack

#

It turns github projects in to maven and gradle repos

#

Then paste link to github page

lean oracle
#

oh woah

#

nice

#

do I do implementation 'com.github.Arnuh:ArmorEquipEvent:1.7.6' or compileOnly

shy dome
#

Click get on the latest version. Select gradle and move that info in to your file

shy dome
#

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

lean oracle
#

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

shy dome
#

Yeah if you want

#

I mean maybe

#

The project will still compile with gradle but eclipse might give warnings

#

Try it

lean oracle
#

now it says cannot be built because path is incomplete

#

when I use gradle build jar

#

I still get some errors

shy dome
#

Could you give full error

lean oracle
queen fjord
shy dome
queen fjord
#

Moreover you should also add shadowJar plugin given that you use implementation

lean oracle
shy dome
#

Could you send your build.gradle

shy dome
lean oracle
shy dome
#

Ah you missed the nuvotifier repo

lean oracle
#

nuvotifier said their repo was jitpack

#

@shy dome

shy dome
#

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

lean oracle
#

I cant use 2.7.3

#

says theres a build error

#

should i use 2.7.2?

shy dome
#

Yeah

lean oracle
#

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

queen fjord
#

What error

#

Paste it

lean oracle
#

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

queen fjord
#

Send the build file

lean oracle
#
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

queen fjord
lean oracle
#

Are those not fixed by the gradle imports?

queen fjord
#

Those are java syntax issues

#

Looks like

lean oracle
#

no they look like they are import issues. For example it is not recognizing the methods available in mojangsonparser

shy dome
#

Make sure they still exist

lean oracle
#

where can I check if they exist. is there a javadoc for nms stuff?

shy dome
#

There isn't

#

You decompile and look