2017-08-26 3 views
0

J'essaie de publier mon projet sur bintray pour la première fois. J'ai lu la documentation ici(rootProject/*: bintrayEnsureLicenses) vous devez définir au moins une licence pour ce projet

https://github.com/sbt/sbt-bintray

Mon fichier plugins.sbt est

addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.1") 

Ceci est mon build.sbt. Vous pouvez voir que je l'ai défini la licence pour mon projet

lazy val publishSettings = Seq(
    licenses += ("MIT", url("http://opensource.org/licenses/MIT")), 
    bintrayOrganization := Some("abhishes"), 
    bintrayRepository := "AbhiTestRepo", 
    bintrayPackageLabels := Seq("foo", "bar") 
) 

lazy val commonSettings = Seq(
    "organization" := "abhishes", 
    version := "1.0", 
    scalaVersion := "2.12.3" 
) 


lazy val project1 = (project in file("SubProject1")).settings(commonSettings) 
    .settings(publishSettings) 
    .settings(
     name := "SubProject1" 
    ) 

lazy val project2 = (project in file("SubProject2")).settings(commonSettings) 
    .settings(publishSettings) 
    .settings(
     name := "SubProject2" 
    ) 

lazy val rootProject = (project in file(".")) 
    .settings(commonSettings) 
    .settings(publishSettings) 
    .settings(
     name := "MyScalaProject" 
).dependsOn(project1, project2) 

quand je dis sbt publish je reçois toujours cette erreur

> publish 
[trace] Stack trace suppressed: run last rootProject/*:bintrayEnsureLicenses for the full output. 
[error] (rootProject/*:bintrayEnsureLicenses) you must define at least one license for this project. Please choose one or more of 
[error] AFL-3.0, AGPL-V3, APL-1.0, APSL-2.0, Apache-1.0, Apache-1.1, Apache-2.0, Artistic-License-2.0, Attribution, BSD, BSD New, BSD Simplified, BSL-1.0, Bouncy-Castle, CA-TOSL-1.1, CDDL-1.0, CPAL-1.0, CPL-1.0, CPOL-1.02, CUAOFFICE-1.0, Codehaus, Day, Day-Addendum, ECL2, EUDATAGRID, EUPL-1.1, Eclipse-1.0, Eiffel-2.0, Entessa-1.0, Fair, Frameworx-1.0, GPL-2.0, GPL-2.0+CE, GPL-3.0, HSQLDB, Historical, IBMPL-1.0, IPAFont-1.0, ISC, IU-Extreme-1.1.1, JA-SIG, JSON, JTidy, LGPL-2.1, LGPL-3.0, Lucent-1.02, MIT, MPL-2.0, MS-PL, MS-RL, MirOS, Motosoto-0.9.1, Mozilla-1.1, Multics, NASA-1.3, NAUMEN, NOSL-3.0, NTP, Nethack, Nokia-1.0a, OCLC-2.0, OSL-3.0, Openfont-1.1, Opengroup, PHP-3.0, PostgreSQL, Public Domain, Public Domain - SUN, PythonPL, PythonSoftFoundation, QTPL-1.0, RPL-1.5, Real-1.0, RicohPL, SUNPublic-1.0, SimPL-2.0, Sleepycat, Sybase-1.0, TMate, Unlicense, UoI-NCSA, VovidaPL-1.0, W3C, WTFPL, Xnet, ZLIB, ZPL-2.0, wxWindows 
[error] Total time: 1 s, completed Aug 26, 2017 1:00:10 PM 
> 

EDIT: Ceci est la sortie de inspect licenses

> inspect licenses 
[info] Setting: scala.collection.Seq[scala.Tuple2[java.lang.String, java.net.URL]] = List() 
[info] Description: 
[info] Project licenses as (name, url) pairs. 
[info] Provided by: 
[info] */*:licenses 
[info] Defined at: 
[info] (sbt.Classpaths) Defaults.scala:1186 
[info] Reverse dependencies: 
[info] rootProject/*:bintrayEnsureBintrayPackageExists 
[info] rootProject/*:projectInfo 
[info] rootProject/*:bintrayEnsureLicenses 
[info] Delegates: 
[info] rootProject/*:licenses 
[info] {.}/*:licenses 
[info] */*:licenses 
[info] Related: 
[info] */*:licenses 
> 

Edit2: Voici la sortie de inspect rootProject/licenses

> inspect rootProject/licenses 
[info] Setting: scala.collection.Seq[scala.Tuple2[java.lang.String, java.net.URL]] = List() 
[info] Description: 
[info] Project licenses as (name, url) pairs. 
[info] Provided by: 
[info] */*:licenses 
[info] Defined at: 
[info] (sbt.Classpaths) Defaults.scala:1186 
[info] Reverse dependencies: 
[info] rootProject/*:bintrayEnsureBintrayPackageExists 
[info] rootProject/*:projectInfo 
[info] rootProject/*:bintrayEnsureLicenses 
[info] Delegates: 
[info] rootProject/*:licenses 
[info] {.}/*:licenses 
[info] */*:licenses 
[info] Related: 
[info] */*:licenses 
+0

Quelle est la sortie de 'inspecter les licences'? – HTNW

+0

J'ai mis à jour la question. –

+0

Pouvez-vous également publier 'inspect rootProject/licenses'? – HTNW

Répondre

0

J'ai été capable de résoudre le problème moi-même. Si vous regardez dans le code source du plugin

https://github.com/sbt/sbt-bintray/blob/7a14108bd273a8bb469ad118ccd7cce5b4042099/src/main/scala/Bintray.scala#L33

Le type de données de licences est Seq [(String, url)]

Sur la base de ce que j'ai changé mon code en conséquence en faisant les licences comme une séquence de tuples de type (String, url) et le problème a été résolu.

lazy val publishSettings = Seq(
    licenses ++= Seq(("MIT", url("http://opensource.org/licenses/MIT"))), 
    bintrayOrganization := Some("abhishes"), 
    bintrayRepository := "AbhiTestRepo", 
    bintrayPackageLabels := Seq("foo", "bar") 
)