Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to add a directories and their content recursively to java application #158

Closed
ivanfrain opened this issue Feb 7, 2014 · 6 comments

Comments

@ivanfrain
Copy link
Contributor

As I described in http://stackoverflow.com/questions/21551854/add-specific-directory-and-its-content-to-universal-target, it would be great to allow a user to add directories and their respective contents in the installation directory of what was defined as java application.

One could write the following:

import com.typesafe.sbt.SbtNativePackager.Universal

mappings in Universal += {
  file("my/local/conffile") -> "conf/my.conf"
  file("my/local/dir") -> "dir"
}

the first entry corresponds to a file and the second entry to a directory with content (files and directories). Both of them are copied into the installation directory generated by the universal:stage task.

@muuki88
Copy link
Contributor

muuki88 commented Feb 7, 2014

Thanks for the pull request. Can you first try if this works for you?

linuxPackageMappings <+= target map { target =>
    packageMapping(
       (target / "scala-2.10" / "api") -> "docs"
    ) withContents()
} 

Related to #92 , #6, #107

Update

This doesn't seem to work with mappings in Universal.

@muuki88
Copy link
Contributor

muuki88 commented Feb 7, 2014

Well this works kind of

mappings in Universal <++= target map { target =>
    packageMapping(
       (target / "scala-2.10" / "api") -> "docs"
    ).withContents().mappings.map {
        case (f,p) => (f.asInstanceOf[java.io.File], p)
    }.toSeq
} 

but is a bit weird, as you have to call universal:packageBin, remove the universal folder and then call universal:packageBin again.

@jsuereth
Copy link
Member

jsuereth commented Feb 7, 2014

The sbt way is a bit wierder, but works:

mappings in Universal ++= {
  val dir = target.value / "scala-2.10" / "api"
  (dir.*** --- dir) x relativeTo(dir)
}

@muuki88
Copy link
Contributor

muuki88 commented Feb 7, 2014

(dir.*** --- dir) pair relativeTo(dir)
What happens here?

@ivanfrain
Copy link
Contributor Author

I saw that before doing my pull request and if I understand well it does
not apply to universal scope, doesn't it ?
For my own usage, I really need a java application bundle as the one you
build using universal:stage or universal:packageBin. I mean
linuxPackageMappings is declared in LinuxPlugin which is not used (unless I
am wrong) in the universal context ?

Another option I was thinking about is to move some part of the
linuxPackageMappings you wrote and the withContents() method in a more
generic part of the package. To be discussed.

(I am a kind of newbee in sbt and sbt-native-manager some my apologize if I
do not understand all the details but I will learn.)

2014-02-07 Muki notifications@github.com:

Thanks for the pull request. Can you first try if this works for you?

linuxPackageMappings += packageMapping(
(target.value / "file.jar") -> "") withContents()

Reply to this email directly or view it on GitHubhttps://github.com//issues/158#issuecomment-34474529
.

Ivan Frain
11, route de Grenade
31530 Saint-Paul-sur-Save
mobile: +33 (0)6 52 52 47 07

@ivanfrain
Copy link
Contributor Author

I would close that one, replaced by #161 which is more comprehensive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants