我正在尝试发布一个内部的libGDX框架,用于我使用神器工作的所有游戏。我一直关注this guide,但是,我被困在项目本身实际发布的位置。我的libGDX项目只有一个核心模块,因为它本身不是游戏,所以我没有制作桌面或Android模块。这是整个项目的构建文件
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release"
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "lichengine"
gdxVersion = '1.9.8'
roboVMVersion = '2.3.3'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile group: 'org.json', name: 'json', version: '20160810'
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
}
}
tasks.eclipse.doLast {
delete ".project"
}
这是核心模块的构建脚本
apply plugin: "java"
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
sourceCompatibility = 1.7
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets.main.java.srcDirs = [ "src/" ]
eclipse.project {
name = appName + "-core"
}
def libraryGroupId = 'my.com.lichengine'
def libraryArtifactId = 'lichengine'
def libraryVersion = '1.0'
publishing {
publications {
aar(MavenPublication) {
groupId libraryGroupId
version libraryVersion
artifactId libraryArtifactId
artifact("$buildDir/publications/aar/${artifactId}-release.aar")
}
}
}
artifactory {
contextUrl = 'http://mywebsite.com:8081/artifactory'
publish {
repository {
repoKey = 'libs-release-local'
username = artifactory_username
password = artifactory_password
}
defaults {
publications('aar')
publishArtifacts = true
properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core']
publishPom = true
}
}
}
当我尝试在根项目或核心项目上运行artifactoryPublish
任务时,我收到以下错误:
lichengine\core\build\publications\aar\lichengine-release.aar' does not exist, and need to be published from publication aar
我错过了什么吗?我在网上搜索的所有内容都是专门针对Android库的,所以没有什么真正有用。看起来应该生成的aar文件不是。
答案 0 :(得分:1)
经过很多痛苦,我想通了。我没有使用aar出版物,而是使用mavenJava。这是我更新的出版物块:
publications {
mavenJava(MavenPublication) {
groupId libraryGroupId
version libraryVersion
artifactId libraryArtifactId
from components.java
}
}
我还必须更新默认阻止
defaults {
publications ('mavenJava')
publishArtifacts = true
properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core']
publishPom = false
}
希望任何看到此内容的人都可以使用它来帮助他们制作带有神器的libGDX库!