ohnosequences / sbt-s3-resolver

:cloud:Amazon S3-based resolver for sbt
GNU Affero General Public License v3.0
117 stars 29 forks source link

Play integration #19

Closed willeeh closed 10 years ago

willeeh commented 10 years ago

Hi,

I'm integrating this pretty plugin in my Play build configuration like this:

// Comment to get more information during initialization
logLevel := Level.Warn

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.1.3")

resolvers += "Era7 maven releases" at "http://releases.era7.com.s3.amazonaws.com"

addSbtPlugin("ohnosequences" % "sbt-s3-resolver" % "0.7.0")

Then, I've created a file called credentials.sbt and filled it:

s3credentialsFile := Some("/Users/guillermoceballos/projects/g4l-web/s3-credentials.properties")

When I run play I got a error:

/Users/guillermoceballos/projects/g4l-web/GymForLess/project/credentials.sbt:1: error: not found: value s3credentialsFile
s3credentialsFile := Some("/Users/guillermoceballos/projects/g4l-web/s3-credentials.properties")
^
/Users/guillermoceballos/projects/g4l-web/GymForLess/project/credentials.sbt:1: error: reassignment to val
s3credentialsFile := Some("/Users/guillermoceballos/projects/g4l-web/s3-credentials.properties")
                  ^
[error] Type error in expression

Apparently s3credentialsFile is not found. Does anyone have a clue about this issue?

laughedelic commented 10 years ago

Hi @willeeh!

I guess, it's just because the settings is called s3CredentialsFile with capital C — before sbt-13 it was s3-credentials-file, so now it has transformed to camelCase ")

But another thing is that you should add the plugin not in <your_project>/build.sbt (may be I just misunderstood you), but in <your_project>/project/plugins.sbt.

Tell me if it helps or the problem remains :wink:

willeeh commented 10 years ago

Hi @laughedelic,

Exactly I had added the plugin in <project>/project/plugins.sbt as you say. Now, I changed:

s3credentialsFile := Some("/Users/guillermoceballos/projects/g4l-web/s3-credentials.properties")

to

s3CredentialsFile := Some("/Users/guillermoceballos/projects/g4l-web/s3-credentials.properties")

And still not working, same error. :angry: Any ideas?

laughedelic commented 10 years ago

Show me please the output of

$ sbt
...
> reload plugins
> update
> reload return
> inspect s3CredentialsFile
willeeh commented 10 years ago

I'm inside of a Play2 environment. I guess I'm using the sbt command provided by Play with no direct access to sbt command. Do you know how to check this out inside Play?

laughedelic commented 10 years ago

Sorry, but I've never used Play, so I even don't know what is this Play environment.. It seems to me a bit strange that you can just launch sbt in your project. But anyway, the point was that maybe you need to clean & reload your project, because it seems that it doesn't see the plugin.

willeeh commented 10 years ago

I'll look into this issue and I'll let you know if it finally works in some way

willeeh commented 10 years ago

@laughedelic Finally I've sort it out! but I just realized my repository is a maven artifact and just wanna download/resolve the library I need. README says:

This plugin can publish maven or ivy artifacts, but it can resolve only ivy-style artifacts. If your maven artifacts are public, you can resolve them using usual sbt resolvers just transforming your s3://my.bucket.com to

"My S3 bucket" at "http://my.bucket.com.s3.amazonaws.com"

How could I do this? I've tried this:

resolvers <++= s3credentials { cs => Seq(
        S3Resolver("Releases resolver", "My S3 bucket" at "http://my.releasebucket.com.s3.amazonaws.com")
      , S3Resolver("G4L Snapshots resolver", "My S3 bucket" at "http://my.snapshotbucket.com.s3.amazonaws.com")
      ) map {r => cs map r.toSbtResolver} flatten
    }

But I got a compilation error due your method signature.

Thanks for your help!

laughedelic commented 10 years ago

@willeeh, if you have public maven artifacts in S3 you don't need this plugin at all. Sorry if the readme is written unclear, I'll try to fix it.

You can try just this (without sbt-s3-resolver):

resolvers ++= Seq(
  "My releases S3 bucket" at "http://my.releasebucket.com.s3.amazonaws.com",
  "My snapshots S3 bucket" at "http://my.snapshotbucket.com.s3.amazonaws.com"
)

(names should be different)

willeeh commented 10 years ago

I'll try this, thanks. Anyway it would be nice to have the repository under security, are you planning to resolve s3 maven artifacts with security at some point?

laughedelic commented 10 years ago

Well, we have an open issue #7 about that. But so far I don't know how to do that and I don't have much time for investigating it. So at some point it should be resolved, but nobody knows when. Anyway, if you know something about how to do that, pull-requests are welcome :wink:

willeeh commented 10 years ago

So far I'm alright with the public artifact but i'd be nice. I'll have a look in a few days if I find a good way to deal with it I'll let you know.