Maven Artifacts - API
maxanier opened this issue ยท 3 comments
Hello,
I would like to add s small compat with AbyssalCraft to my mod Vampirism, but stumbled across a few issues with adding just the API as dependency.
If adding it as dependency, it is downloaded and appears in IntelliJ, but I cannot refer to any of those classes.
Gradle also fails on build:
/home/max/Dokumente/Programmieren/IntelliJ Minecraft/1.11/Vampirism/build/sources/main/java/de/teamlapen/vampirism/modcompat/abyssalcraft/AbyssalCraftBiomes.java:3: error: package com.shinoow.abyssalcraft.api.biome does not exist
I'm not sure if it caused by the fact that the 'apiVersion' in the package-info files refers to a variable or if the zip format causes trouble.
My dependency in the build.gradle:
deobfCompile 'com.shinoow.abyssalcraft:AbyssalCraft:'+config.minecraft_version+'-'+config.abyssalcraft_version+':api@zip
Is there a specific reason you are using the zip format for the API instead of jar. E.g.
task apiJar(type: Jar, dependsOn: 'classes') {
from sourceSets.main.allSource
from sourceSets.main.output
include 'de/teamlapen/vampirism/api/**/*'
classifier 'api'
}
Regarding the apiVersion: It's probably much more comfortable to just refer to the version string, but IntelliJ reports that the AbyssalCraftAPI class cannot be resolved (even though it is found).
Not sure if using hardcoded versions would solve the problem, but e.g. mezz uses them for the JEI API and probably has reasons for that.
If I depend on the dev artifact everything works fine, but I would like to only use the API.
BTW: The instructions in your README refer to the wrong package:
dependencies {
deobfCompile "com.shinoow.abyssalcraft:Abyssalcraft:<mcversion>-<acversion>:<classifier>"
}
It has to be 'AbyssalCraft'.
The API artifact has remained a zip file since I haven't changed it from before adding the maven repo (since before the maven, you'd pick up the API from the additional files on the CF page, then drop it in src/api/java). I've been meaning to restructure the maven stuff for a while, so I might as well take the first step there (by moving the API artifact to a jar file instead of a zip). Good catch on the package bit btw, didn't notice I made that typo there.
As the current artifact simply is a zip containing the sources for the API package, any files for it don't get picked up by gradle (which, for me, displays it as a jar file filled with empty directories, not sure how much that differs on IDEA, as I use Eclipse), as it probably looks for class files rather than java files. I'll swap the latest API artifacts with jar ones structured similar to JEI (should clear this up).