#Maven Publish build.gradle, I need some help.
1 messages ยท Page 1 of 1 (latest)
just use maven lol
Is there a way that I can switch my project from gradle to maven?
dont
Don't?
idk im stupid
Well what do you use ๐
gradle :)
Oh, do you know how to do it then ?
never published to public tho
Welll I need to do it locally.
https://docs.gradle.org/8.8/userguide/publishing_maven.html
i followed this i think
Not public sorry.
use whatever build system you feel most comfortable using
if you just want it local you can just run the publishToMavenLocal with adding a publishing config
groovy or kotlin dsl?
publishing {
publications {
maven(MavenPublication) {
from components.java
artifactId = "tottoriutils"
}
}
}
my publishing task for gradle 8.8 for reference
Idk what that is ๐
no pointin adding mavenLocal there
there is task for it
oh true
is ur build file build.gradle or build.gradle.kts
Oh I use build.gradle.
add ```
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}
then just run the publishToMavenLocal task and its on your maven local, to use it make sure you have mavenLocal() in the repositories
for me the casing was wrong tho
@leaden copper See https://reposilite.com/guide/gradle
oh okay
well i'm having the following issue
Build file 'C:\Users\andre\Desktop\MC-Plugins\Library\build.gradle' line: 8
A problem occurred evaluating root project 'Library'.
> Could not find method publishing() for arguments [build_b2ltjvj9w4m8zjs6sl3xxs8xr$_run_closure1@5e807a9a] on root project 'Library' of type org.gradle.api.Project.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
where exactly does this go into?
the the build.gradle, it should be its own declaration
plugins {
id 'java'
}
group = 'com.ancho.library'
version = '1.0'
repositories {
mavenCentral()
maven {
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
content {
includeGroup 'org.bukkit'
includeGroup 'org.spigotmc'
}
}
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
}
dependencies {
testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation 'org.junit.jupiter:junit-jupiter'
implementation 'org.apache.commons:commons-lang3:3.12.0'
compileOnly 'org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT'
compileOnly 'org.spigotmc:spigot:1.20.2-R0.1-SNAPSHOT'
}
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}
test {
useJUnitPlatform()
}```
You need to add the maven-publish plugin
id 'maven-publish' I believe
yeap
'maven' cannot be applied to '(java.lang.Class<org.gradle.api.publish.maven.MavenPublication>, groovy.lang.Closure<org.gradle.api.publish.Publication>)'
Cannot infer argument types
Also if you're depending on the spigot server, no need to depend on the API nor depend on apache commons lang
these are just warnings, but they're not gonna cause any issues, right?
It's create(MavenPublication)
publishing {
publications {
create(MavenPublication) {
from components.java
groupId = 'com.ancho.library'
artifactId = 'AnchoLibrary'
version = '1.0'
}
}
}``` This is the correct one, right?
Well I wanna publish it locally.
Oh yeah then that's enough
so mavenLocal()?
the publishToMavenLocal task exists, you don't need to add a repo
Yeah, make sure to add your local maven repo
with mavenLocal()
Yeap
yeah mavenLocal() should be good into the repositories, right?
Yes
Perfect, thank you so much mate!