Git Product home page Git Product logo

Comments (21)

xerial avatar xerial commented on September 24, 2024 1

@alexflav23 Thanks. I got the pain point. sbt plugin should be used safely without such a conditional switch.

from sbt-sonatype.

xerial avatar xerial commented on September 24, 2024

Thanks for the feedback. I didn't notice that the global plugins (e.g., specified in ~/.sbt/0.13/plugins/...) have higher precedence than the project settings. Is it true?

If so, we should let sbt-sonatype users manually set publishTo.

from sbt-sonatype.

cvogt avatar cvogt commented on September 24, 2024

seems to be the case. @eed3si9n?

Setting manually seems safer.

from sbt-sonatype.

eed3si9n avatar eed3si9n commented on September 24, 2024

If you're using the auto plugin correctly, and not doing the Project(..., settings = ...) , the user-defined settings should be ordered after the auto plugin's settings.

from sbt-sonatype.

cvogt avatar cvogt commented on September 24, 2024

@eed3si9n correctly on the side of the plugin author or user? I as the user just added it via addPlugin to my global plugins.sbt, nothing else, so I suppose it must be on the plugins side.

Also if I have a multi project built, one sub-project configured to deploy to bintray and nothing configure for the others, would a publish on the root project deploy my other sub-projects to sonatype then? Sounds not ideal. @xerial how about making publishTo a manual opt-in?

from sbt-sonatype.

xerial avatar xerial commented on September 24, 2024

It looks like a newly added code in sbt-sonatype 1.1, which updates publishTo, might be causing the problem: https://github.com/xerial/sbt-sonatype/blob/master/src/main/scala/xerial/sbt/Sonatype.scala#L124.

@cvogt
Does the same problem happen if you use sbt-sonatype 1.0?

from sbt-sonatype.

cvogt avatar cvogt commented on September 24, 2024

@xerial I was actually using 0.5.1, but confirmed the same problem also exists with 1.0 and 1.1.

from sbt-sonatype.

eed3si9n avatar eed3si9n commented on September 24, 2024

@cvogt On the side of the build user. Does your build look like this?

val foo = project.settings(publishTo := Some(x))

and Some(x) is taken over by the setting from a plugin?

from sbt-sonatype.

cvogt avatar cvogt commented on September 24, 2024

It looks like this. Is there a different recommended way to propagate the setting to all sub projects?

object MyBuild extends Build {
  override lazy val settings =
    super.settings ++
      Seq(
        publishTo := {
          Some( ... )
        },
        ...
      )
}

from sbt-sonatype.

xerial avatar xerial commented on September 24, 2024

It seems the use of lazy for the settings causes the unintentional overwrite.

from sbt-sonatype.

xerial avatar xerial commented on September 24, 2024

@cvogt I cannot reproduce this issue:

$ cat build.sbt
publishTo := Some("repo" at "http://some.repo.org")
$ sbt "show publishTo"                                                                                                                                                                                             [9:19:30 Apr 04 2016]
[info] Loading global plugins from /Users/leo/.sbt/0.13/plugins
[info] Set current project to sonatype-test (in build file:/Users/leo/work/git/tmp/sonatype-test/)
[info] Some(repo: http://some.repo.org)

$ cat build.sbt
// publishTo := Some("repo" at "http://some.repo.org")
$ sbt "show publishTo"                                                                                                                                                                                             [9:20:51 Apr 04 2016]
[info] Loading global plugins from /Users/leo/.sbt/0.13/plugins
[info] Set current project to sonatype-test (in build file:/Users/leo/work/git/tmp/sonatype-test/)
[info] Some(sonatype-snapshots: https://oss.sonatype.org/content/repositories/snapshots)

from sbt-sonatype.

eed3si9n avatar eed3si9n commented on September 24, 2024

@cvogt

It looks like this. Is there a different recommended way to propagate the setting to all sub projects?

Make an one-off auto plugin inside project/*.scala. http://www.scala-sbt.org/0.13/docs/Organizing-Build.html#Defining+auto+plugins

from sbt-sonatype.

dwijnand avatar dwijnand commented on September 24, 2024

Here's an example: https://github.com/sbt/sbt-pgp/blob/v1.0.0/project/Common.scala

from sbt-sonatype.

alexflav23 avatar alexflav23 commented on September 24, 2024

+1 On this, it's still a problem as of the latest release. I cannot add the plugin without having it override all bintray publishing settings for instance.

from sbt-sonatype.

xerial avatar xerial commented on September 24, 2024

@alexflav23 Does it mean you need to have both sonatype and bintray repositories for publishing? If so I agree with that having pre-defined publishTo is cumbersome.

from sbt-sonatype.

alexflav23 avatar alexflav23 commented on September 24, 2024

Hi @xerial,

No, it means simply including sbt-sonatype as an SBT plugin will override any other publishTo setting found in the project, so we need to work around it.

For example here, where we toggle an environment variable in the CI server which prevents the build from loading the plugin in the first place, just so we can publish to bintray.

Regards.

from sbt-sonatype.

xerial avatar xerial commented on September 24, 2024

sbt-sonatype do not set publishTo by default since 2.0.0-M1 (for sbt-1.0.0-M5)

from sbt-sonatype.

cvogt avatar cvogt commented on September 24, 2024

Nice :)!!! Any chance we can get it for sbt 0.13?

from sbt-sonatype.

xerial avatar xerial commented on September 24, 2024

Now working on cross building sbt plugins.

from sbt-sonatype.

xerial avatar xerial commented on September 24, 2024

Uploaded sbt-sonatype 2.0.0-M1 for sbt 0.13.x
https://oss.sonatype.org/content/repositories/releases/org/xerial/sbt/sbt-sonatype_2.10_0.13/2.0.0-M1/

from sbt-sonatype.

cvogt avatar cvogt commented on September 24, 2024

awesome, thx so much!

from sbt-sonatype.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.