Skip to content

Commit

Permalink
Make build.gradle publish to Nexus
Browse files Browse the repository at this point in the history
  • Loading branch information
aksel-bondoe authored Apr 27, 2021
1 parent 4358df1 commit b0eb024
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 20 deletions.
9 changes: 6 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,15 @@ To compile and publishing to your local maven repository, run
gradle publishToMavenLocal
```

To upload to bintray, set bintrayUsername and bintrayApiKey in ~/.gradle/gradle.properties and run

To upload snapshot to artifacts.halodi.com:
```
gradle bintrayUpload
ARTIFACT_USERNAME=[username] ARTIFACT_PASSWORD=[password] ARTIFACT_VERSION=[version] gradle publish
```

To upload release to artifacts.halodi.com:
```
ARTIFACT_USERNAME=[username] ARTIFACT_PASSWORD=[password] ARTIFACT_VERSION=[version] gradle publish -PenvironmentName=release
```

## Folder structure

Expand Down
38 changes: 21 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
buildscript {
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
mavenLocal()
jcenter()
}

dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+'
classpath 'net.saliman:gradle-properties-plugin:1.5.1'
}


}

apply plugin: 'java'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'net.saliman.properties'


def vcsurl = 'https://github.com/halodi/halodi-robot-models'
group = "com.halodi"
version = "2.3.3"
def inputVersion= project.hasProperty("artifactVersion") ?
project.getProperty("artifactVersion"): System.getenv('ARTIFACT_VERSION')
version = "$inputVersion$versionAppendix"
def repoUrl = "https://artifacts.halodi.com/repository"

def excludedFiles = [ '**/build', '**/cmake', '**/CMakeLists.txt', '**/package.xml', '**/model.config', '**/urdf.in', 'unity' ]

Expand Down Expand Up @@ -91,16 +93,18 @@ publishing {
}



bintray {
user = project.hasProperty('bintrayUsername') ? project.property('bintrayUsername') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
pkg {
repo = 'maven-release'
name = project.name
userOrg = 'halodirobotics'
licenses = ['Apache-2.0']
vcsUrl = vcsurl
publishing {
repositories {
maven {
def inputUsername = project.hasProperty("artifactUsername") ?
project.getProperty("artifactUsername"): System.getenv('ARTIFACT_USERNAME')
def inputPassword = project.hasProperty("artifactPassword") ?
project.getProperty("artifactPassword"): System.getenv('ARTIFACT_PASSWORD')
credentials {
username inputUsername
password inputPassword
}
url "$repoUrl$repository"
}
}
publications = ['JavaPublication']
}
3 changes: 3 additions & 0 deletions gradle-release.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
repository=/maven-open-source-release
environment=release
versionAppendix=
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
repository=/maven-open-source-snapshots
environment=development
versionAppendix=-SNAPSHOT

0 comments on commit b0eb024

Please sign in to comment.