Similar questions:
Currently the “maven” plugin supports many protocols: SCP, SSH, FTP, etc (Untitled)
Can we add the same support to the “maven-publish” plugin?
Similar questions:
Currently the “maven” plugin supports many protocols: SCP, SSH, FTP, etc (Untitled)
Can we add the same support to the “maven-publish” plugin?
SFTP is supported. One limitation though is it only supports authentication via username/password. That means no private key auth at the moment if using ‘maven-publish’.
Is there a JIRA we can vote for private key? Also, client certificates for https may be useful for automating push to production repositories.
@ddimitrov I’ve created GRADLE-3472 and GRADLE-3473 to track this.
@mark_vieira Thanks for creating those issues.
I agree. can you put on the maven-publish plugin page on how to scp as some people like myself until i found this issue will not know that maven-publish plugin supports scp.
publishing {
publications {
mavenJava(MavenPublication)
{
artifact shadowJar
//from components.java
}
}
repositories {
maven {
//checks for a the local property as a gradle argument and if exists outputs to a local dir.
if (project.hasProperty("local") && project.getProperty("local") == "true")
url "file:" + projectDir.path + "/build/maven"
elseif (project.hasProperty("BBMuser")
url: "sftp://builtbroken.com:22767"
credentials {
username project.BBMuser
password project.BBMpassword
}
}
}
}
* Where:
Build file 'C:\Users\Myahm\Desktop\coding\git\MC\github\oblivion\Launcher\launcher\build.gradle' line: 64
* What went wrong:
Could not compile build file 'C:\Users\Myahm\Desktop\coding\git\MC\github\oblivion\Launcher\launcher\build.gradle'.
> startup failed:
build file 'C:\Users\Myahm\Desktop\coding\git\MC\github\oblivion\Launcher\launcher\build.gradle': 64: unexpected token: url @ line 64, column 17.
url: "sftp://builtbroken.com:22767"
^
1 error
any clues what i am doing wrong?
Should be url = "sftp://..."
or alternatively you can omit the =
operator but colons (:
) are used in Groovy to define a Map
not to perform assignment.
publishing {
publications {
mavenJava(MavenPublication)
{
artifact shadowJar
//from components.java
}
}
repositories {
maven {
//checks for a the local property as a gradle argument and if exists outputs to a local dir.
if (project.hasProperty("local") && project.getProperty("local") == "true")
url "file:" + projectDir.path + "/build/maven"
elseif (project.hasProperty("BBMuser")
url = "sftp:///builtbroken.com:22767"
credentials {
username project.BBMuser
password project.BBMpassword
}
}
}
}
Build file 'C:\Users\Myahm\Desktop\coding\git\MC\github\oblivion\Launcher\launcher\build.gradle' line: 66
* What went wrong:
Could not compile build file 'C:\Users\Myahm\Desktop\coding\git\MC\github\oblivion\Launcher\launcher\build.gradle'.
> startup failed:
build file 'C:\Users\Myahm\Desktop\coding\git\MC\github\oblivion\Launcher\launcher\build.gradle': 66: unexpected token: url @ line 66, column 17.
url = "sftp:///builtbroken.com:22767"
^
1 error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
still the same error. I am now confused as to what is causing it.
can you also add a working example to https://docs.gradle.org/current/userguide/publishing_maven.html so it’s easier for people to understand how it works?
any updates on how to get this working?
You cannot omit braces when using elseif
. You’ll have to add the curly braces.
if (project.hasProperty("local") && project.getProperty("local") == "true") {
url "file:" + projectDir.path + "/build/maven"
} elseif (project.hasProperty("BBMuser") {
url = "sftp:///builtbroken.com:22767"
credentials {
username project.BBMuser
password project.BBMpassword
}
}