[error] (*:publish) java.io.IOException: PUT operation to URL http://corporate.nexus:8081/repository/snapshots/service/local/staging/deploy/1.0/foo-1.0.pom failed with status code 503: Service Unavailable [error] Total time: 23 s, completed Jun 9, 2017 12:09:15 PM
I am getting this error when trying to use sbt publish to publish my jar to my nexus repository 3.13 maven repo.
I have the following configurations in the build.sbt
publishTo := {
val nexus = "http://corporate.nexus:8081/repository/snapshots/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
credentials += Credentials("Nexus Repository Manager", "corporate.nexus:8081/", "admin", "admin123")
publishMavenStyle := true
I am able to push the jar using maven 2 [ mvn deploy:deploy-file ]. but not mvn 3.
The realm name for the Nexus has to be exactly "Sonatype Nexus Repository Manager" case-sensitive. Not sure where to find the exact name for the Nexus and if it differs from version to version. This is for Nexus 3.
Related
I'm trying to push a fat jar generated by sbt-publish to a private Nexus repository. So, in my Nexus, I've created two repositories, one hosting snapshots version and one hosting releases artifacts.
Here is the important code in my build.sbt:
publishTo := {
val nexus = "http://localhost:8081/"
if (isSnapshot.value)
Some("snapshots" at nexus + "repository/test-snapshots")
else
Some("releases" at nexus + "repository/test-releases")
}
credentials += Credentials(
"Sonatype Nexus Repository Manager", "localhost", "admin", "admin123"
)
artifact in (Compile, assembly) := {
val art = (artifact in (Compile, assembly)).value
art.withClassifier(Some("assembly"))
}
addArtifact(artifact in (Compile, assembly), assembly)
Here's a part of the stacktrace:
[info] Assembly up to date: /.../target/scala-2.11/test-assembly-1.0-SNAPSHOT.jar
[info] published test_2.11 to http://localhost:8081/repository/test-snapshots/com/test/test_2.11/1.0-SNAPSHOT/test_2.11-1.0-SNAPSHOT-javadoc.jar
[info] published test_2.11 to http://localhost:8081/repository/test-snapshots/com/test/test_2.11/1.0-SNAPSHOT/test_2.11-1.0-SNAPSHOT-sources.jar
[info] published test_2.11 to http://localhost:8081/repository/test-snapshots/com/test/test_2.11/1.0-SNAPSHOT/test_2.11-1.0-SNAPSHOT.jar
[info] published test_2.11 to http://localhost:8081/repository/test-snapshots/com/test/test_2.11/1.0-SNAPSHOT/test_2.11-1.0-SNAPSHOT.pom
[error] java.net.SocketException: Broken pipe (Write failed)
So, as we can see, it is able to publish the artifacts until the pom file.
Thank you in advance for your help !
I have a multi-project sbt where I use sbt-release plugin. Everything works fine if I run release in a sub-project
> project reporter
[info] Set current project to reporter (in build file:/source/storage-integ/)
> release
[info] Starting release process off commit: c069698baf8bb6fca611ab4e7e086398aab473c5
[info] Checking remote [origin] ...
But this doesn't work when I run "sbt reporter/release" from cli. Where as "sbt reporter/compile" or "sbt reporter/assembly" do work.
$ sbt reporter/release
[warn] Executing in batch mode.
[warn] For better performance, hit [ENTER] to switch to interactive mode, or
[warn] consider launching sbt without any commands, or explicitly passing 'shell'
[info] Loading global plugins from /home/vagrant/.sbt/0.13/plugins
[info] Loading project definition from /source/storage-integ/project
[info] Set current project to root (in build file:/source/storage-integ/)
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: release (similar: releaseVcs, rpmRelease, rpm-release)
[error] reporter/release
This looks very similar to another SO post. I tried adding releaseSettings to build.sbt as suggested but it throws error
build.sbt:62: error: not found: value releaseSettings
I tried import sbtrelease.Release._ but that throws
error: object Release is not a member of package sbtrelease
At this point I feel the solution mentioned is no longer valid. Also, I don't see any reference to releaseSettings in sbt-release readme. Any idea how to get this working?
sbt.version = 0.13.15 && sbt-release: "1.0.6"
The release settings should be only in your root project. So, in order to have that:
First, your build.sbt could be something like this
lazy val root: Project = project.in(file("."))
.settings(Releases.settings: _*)
.aggregate(module1, module2)
Then, your project/Releases.scala like:
object Releases {
// You need to custom these to reflect your actual procedure
private val releaseProcess = Def.setting {
Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
publishArtifacts,
setNextVersion,
commitNextVersion,
pushChanges
)
}
val settings = Seq(
releaseCommitMessage := s"Set version to ${(version in ThisBuild).value}",
releaseTagName := (version in ThisBuild).value,
releaseProcess := releaseProcess.value
)
}
By default you need a version.sbt with your current version. Lets say:
version in ThisBuild := "1.0.0-SNAPSHOT"
Then just:
sbt release
When publishing our plugin we got this
[info] Done packaging.
[trace] Stack trace suppressed: run last *:publish for the full output.
[error] (*:publish) java.io.IOException: PUT operation to URL https://nexus.mycompany.com/repository/maven-snapshots/com/foo/foo-sbt-plugin_2.10_0.13/1.0.0-SNAPSHOT/foo-sbt-plugin-1.0.0-SNAPSHOT.pom failed with status code 400: Invalid path for a Maven 2 repository
We set up the plugin using
sbtPlugin := true
publishMavenStyle := true
This was fixed by setting the repository Layout Policy to permissive in the nexus admin.
http://nexus.mycompany.com/#admin/repository/repositories:maven-releases
http://nexus.mycompany.com/#admin/repository/repositories:maven-snapshots
I try to generate an Eclipse Project with Springfuse code generator, based on a MySql database. I have filled up the form at http://www.springfuse.com/, and it generated following Maven command:
mvn -U archetype:generate -DarchetypeGroupId=com.springfuse.archetypes -DarchetypeArtifactId=quickstart -DarchetypeVersion=3.0.108 -DgroupId=com.company.demo -Dpackage=com.company.demo -DartifactId=myproject -Dversion=1.0.0 -DfrontEnd=jsf2Spring -Demail=peter.varga.sp#gmail.com -Dpassword=none -DjdbcGroupId=mysql -DjdbcArtifactId=mysql-connector-java -DjdbcVersion=5.1.25 -DjdbcDriver=com.mysql.jdbc.Driver -DjdbcUser=root -DjdbcPassword=qwe123 -DjdbcUrl=jdbc:mysql://localhost/test -DinteractiveMode=false -DarchetypeRepository=http://maven2.springfuse.com/
I opened a command window, copied the command as it is, and run it, but got following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.springfuse.archetypes:quickstart:3.0.108) -> [Help 1]
My environment details:
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00)
Maven home: c:\Prog\Maven\Maven.3.2.1
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: c:\Program Files\Java\jdk1.7.0_51\jre
Default locale: en_US, platform encoding: Cp1250
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Does anybody has an idea, what the problem is?
Thanks.
Please check the settings of proxy / firewall springfuse. Also check the Apache Maven, because it needs to download the dependencies on the Internet. And if it fails, then its usually you need to tell him about the http proxy you need to use.
I have an internal maven repository located at file:///some/path/here. I would like to publish my sbt artifacts to this location. I gleaned that the following should work.
publishMavenStyle := true
publishTo <<= version { (v: String) =>
val path = "file:///some/path/here/"
if (v.trim.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "maven-snapshots")
else
Some("releases" at nexus + "maven")
}
However, this fails with the following exception.
[info] delivering ivy file to .../target/scala-2.9.2/ivy-1.0-SNAPSHOT.xml
java.lang.UnsupportedOperationException: URL repository only support HTTP PUT at the moment
at org.apache.ivy.util.url.BasicURLHandler.upload(BasicURLHandler.java:202)
at org.apache.ivy.util.FileUtil.copy(FileUtil.java:150)
at org.apache.ivy.plugins.repository.url.URLRepository.put(URLRepository.java:84)
How can I publish artifacts using sbt to a repository specified by a file path?
Use this format to publish to a local file path:
publishTo := Some(Resolver.file("file", new File("/some/path/here")))