L
Lieven Cardoen
Guest
I'm trying to use Gradle in combination with Ant to build our OpenEdge projects. OpenEdge is a 4GL language from some centuries ago. ;-)
Anyway, I've managed downloading some jar dependencies, but now I'm stuck in how to publish a PL file (Progress Library) to a Nexus repository. The thing is that like Maven, Gradle also seems to be made for Java projects.
This is my script (I also have a settings.gradle file with rootProject.name = 'stomp'):
apply plugin:'java'
apply plugin: 'maven-publish'
group 'be.mips'
version = '1.4.0-SNAPSHOT'
repositories {
/*
Gradle uses the same logic as Maven to identify the location of your local
Maven cache. If a local repository location is defined in a settings.xml,
this location will be used. The settings.xml in USER_HOME/.m2 takes precedence
over the settings.xml in M2_HOME/conf. If no settings.xml is available, Gradle
uses the default location USER_HOME/.m2/repository.
*/
mavenLocal()
maven {
credentials {
username '****'
password '****'
}
url "http://srv-ci-nexus:8082/nexus/content/repositories/MadeApplReleases/"
url "http://srv-ci-nexus:8082/nexus/content/repositories/MadeApplSnapshots/"
}
mavenCentral()
}
def stompProgressLibraryFile = file('dist/lib/STOMP.PL')
artifacts {
archives stompProgressLibraryFile
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact stompProgressLibraryFile
}
}
repositories {
maven {
// default credentials for a nexus repository manager
credentials {
username '****'
password '****'
}
// url to the releases maven repository
url "http://srv-ci-nexus:8082/nexus/repositories/snapshots"
}
}
}
configurations {
antconf
}
dependencies {
antconf 'be.mips:mips-progress-ant-tasks:1.5.8-SNAPSHOT',
'be.mips:mips-pct:1.0-SNAPSHOT',
'ant-contrib:ant-contrib:1.0b3'
}
/* Loads the jars */
ClassLoader antClassLoader = org.apache.tools.ant.Project.class.classLoader
configurations.antconf.each {
File f -> antClassLoader.addURL(f.toURI().toURL())
}
/* Extend clean task */
clean.doFirst {
delete '_ant_rcode', 'src', 'dist'
println 'deleted directories'
}
/* Create dist/lib directory as prolib does not create directory automatically */
task init(dependsOn: clean) {
doLast{
project.file('dist/lib').mkdirs()
println 'created dist/lib'
}
}
ant.importBuild 'build.xml'
Running gradle publish gives me next output:
C:\Workspace\git-repositories\OpenEdge\stomp.git>gradle -DDLC=C:\OpenEdge\116\DLC publish :generatePomFileForMavenJavaPublication :compileJava UP-TO-DATE rocessResources UP-TO-DATE :classes UP-TO-DATE :jar UP-TO-DATE ublishMavenJavaPublicationToMavenRepository Could not find metadata be.mips:stomp:1.4.0-SNAPSHOT/maven-metadata.xml in remote (http://srv-ci-nexus:8082/nexus/repositories/snapshots) Upload http://srv-ci-nexus:8082/nexus/repo....0-SNAPSHOT/stomp-1.4.0-20161227.115652-1.pom Could not transfer artifact be.mips:stompom:1.4.0-20161227.115652-1 from/to remote (http://srv-ci-nexus:8082/nexus/repositories/snapshots): Could not write to resource 'be/mips/stomp/1.4.0-SNAPSHOT/stomp-1.4.0-20161227.115652-1.pom' Upload http://srv-ci-nexus:8082/nexus/repo....0-SNAPSHOT/stomp-1.4.0-20161227.115652-1.jar Could not transfer artifact be.mips:stomp:jar:1.4.0-20161227.115652-1 from/to remote (http://srv-ci-nexus:8082/nexus/repositories/snapshots): Could not write to resource 'be/mips/stomp/1.4.0-SNAPSHOT/stomp-1.4.0-20161227.115652-1.jar' Upload http://srv-ci-nexus:8082/nexus/repo...4.0-SNAPSHOT/stomp-1.4.0-20161227.115652-1.pl Could not transfer artifact be.mips:stompl:1.4.0-20161227.115652-1 from/to remote (http://srv-ci-nexus:8082/nexus/repositories/snapshots): Could not write to resource 'be/mips/stomp/1.4.0-SNAPSHOT/stomp-1.4.0-20161227.115652-1.pl' ublishMavenJavaPublicationToMavenRepository FAILED
FAILURE: Build failed with an exception.
BUILD FAILED
Total time: 1.089 secs
The first thing I notice is having these java tasks that I do not need. :compileJava, rocessResource, :classes, :jar ...
Basically I had a build.xml ant file doing everything I wanted. But the dependency management in ant is very poor. So I decided to use Gradle in combination with Ant. I want Gradle to do the dependency management for me. So far downloading dependencies seems to work fine (will have to try with a PL instead of a jar). But publishing something else than a jar, how do you do that?
Read a lot of the Gradle Online Documentation, but all the examples seem to be based on java.
Continue reading...
Anyway, I've managed downloading some jar dependencies, but now I'm stuck in how to publish a PL file (Progress Library) to a Nexus repository. The thing is that like Maven, Gradle also seems to be made for Java projects.
This is my script (I also have a settings.gradle file with rootProject.name = 'stomp'):
apply plugin:'java'
apply plugin: 'maven-publish'
group 'be.mips'
version = '1.4.0-SNAPSHOT'
repositories {
/*
Gradle uses the same logic as Maven to identify the location of your local
Maven cache. If a local repository location is defined in a settings.xml,
this location will be used. The settings.xml in USER_HOME/.m2 takes precedence
over the settings.xml in M2_HOME/conf. If no settings.xml is available, Gradle
uses the default location USER_HOME/.m2/repository.
*/
mavenLocal()
maven {
credentials {
username '****'
password '****'
}
url "http://srv-ci-nexus:8082/nexus/content/repositories/MadeApplReleases/"
url "http://srv-ci-nexus:8082/nexus/content/repositories/MadeApplSnapshots/"
}
mavenCentral()
}
def stompProgressLibraryFile = file('dist/lib/STOMP.PL')
artifacts {
archives stompProgressLibraryFile
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact stompProgressLibraryFile
}
}
repositories {
maven {
// default credentials for a nexus repository manager
credentials {
username '****'
password '****'
}
// url to the releases maven repository
url "http://srv-ci-nexus:8082/nexus/repositories/snapshots"
}
}
}
configurations {
antconf
}
dependencies {
antconf 'be.mips:mips-progress-ant-tasks:1.5.8-SNAPSHOT',
'be.mips:mips-pct:1.0-SNAPSHOT',
'ant-contrib:ant-contrib:1.0b3'
}
/* Loads the jars */
ClassLoader antClassLoader = org.apache.tools.ant.Project.class.classLoader
configurations.antconf.each {
File f -> antClassLoader.addURL(f.toURI().toURL())
}
/* Extend clean task */
clean.doFirst {
delete '_ant_rcode', 'src', 'dist'
println 'deleted directories'
}
/* Create dist/lib directory as prolib does not create directory automatically */
task init(dependsOn: clean) {
doLast{
project.file('dist/lib').mkdirs()
println 'created dist/lib'
}
}
ant.importBuild 'build.xml'
Running gradle publish gives me next output:
C:\Workspace\git-repositories\OpenEdge\stomp.git>gradle -DDLC=C:\OpenEdge\116\DLC publish :generatePomFileForMavenJavaPublication :compileJava UP-TO-DATE rocessResources UP-TO-DATE :classes UP-TO-DATE :jar UP-TO-DATE ublishMavenJavaPublicationToMavenRepository Could not find metadata be.mips:stomp:1.4.0-SNAPSHOT/maven-metadata.xml in remote (http://srv-ci-nexus:8082/nexus/repositories/snapshots) Upload http://srv-ci-nexus:8082/nexus/repo....0-SNAPSHOT/stomp-1.4.0-20161227.115652-1.pom Could not transfer artifact be.mips:stompom:1.4.0-20161227.115652-1 from/to remote (http://srv-ci-nexus:8082/nexus/repositories/snapshots): Could not write to resource 'be/mips/stomp/1.4.0-SNAPSHOT/stomp-1.4.0-20161227.115652-1.pom' Upload http://srv-ci-nexus:8082/nexus/repo....0-SNAPSHOT/stomp-1.4.0-20161227.115652-1.jar Could not transfer artifact be.mips:stomp:jar:1.4.0-20161227.115652-1 from/to remote (http://srv-ci-nexus:8082/nexus/repositories/snapshots): Could not write to resource 'be/mips/stomp/1.4.0-SNAPSHOT/stomp-1.4.0-20161227.115652-1.jar' Upload http://srv-ci-nexus:8082/nexus/repo...4.0-SNAPSHOT/stomp-1.4.0-20161227.115652-1.pl Could not transfer artifact be.mips:stompl:1.4.0-20161227.115652-1 from/to remote (http://srv-ci-nexus:8082/nexus/repositories/snapshots): Could not write to resource 'be/mips/stomp/1.4.0-SNAPSHOT/stomp-1.4.0-20161227.115652-1.pl' ublishMavenJavaPublicationToMavenRepository FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task 'ublishMavenJavaPublicationToMavenRepository'.
Failed to publish publication 'mavenJava' to repository 'maven' Failed to deploy artifacts: Could not transfer artifact be.mips:stompom:1.4.0-20161227.115652-1 from/to remote (http://srv-ci-nexus:8082/nexus/repositories/snapshots): Could not write to resource 'be/mips/stomp/1.4.0-SNAPSHOT/stomp-1.4.0-20161227.115652-1.pom'
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1.089 secs
The first thing I notice is having these java tasks that I do not need. :compileJava, rocessResource, :classes, :jar ...
Basically I had a build.xml ant file doing everything I wanted. But the dependency management in ant is very poor. So I decided to use Gradle in combination with Ant. I want Gradle to do the dependency management for me. So far downloading dependencies seems to work fine (will have to try with a PL instead of a jar). But publishing something else than a jar, how do you do that?
Read a lot of the Gradle Online Documentation, but all the examples seem to be based on java.
Continue reading...