Comments (10)
I am reluctant to add any sort of file transformation magic. I think sbt-assembly should focus on getting files together in one jar. You could probably define a sbt task to merge files together and generate one yourself.
from sbt-assembly.
Yes, I understand your reluctance, but adding an external merging task is not enough: the result would still need to be inserted into the fat jar, and that is currently not possible, given that it must have the same name as the things it was merged from.
from sbt-assembly.
I wonder if I could refactor the sbt-assembly to give you a task that generates the raw list of files right before it gets packaged into the jar. Suppose we call it assembledFiles or something. That'll give you a hook point to place whatever you want in there after ignoring reference.conf
from all jars.
from sbt-assembly.
That sounds like it might just cut it: then we just need a task which can for a given project retrieve and merge all reference.conf and put the result somewhere which is also ignored.
from sbt-assembly.
Added assembledMappings
task and published 0.7.4: a2779b1
from sbt-assembly.
Thanks a bunch, will look into in when I’m back from vacation (next week)!
from sbt-assembly.
Sorry, it took a bit longer. I got the desired effect using the following:
assembledMappings in assembly <<= (assembledMappings in assembly) map { (old: File => Seq[(File, String)]) =>
(f: File) => old(f) :+ (file("src/main/resources/reference.conf"), "reference.conf")
}
I guess there is some nicer way with some other SBT operator, but this also works :-)
One little thing: where did you publish 0.7.4? I had to publish-local to test this …
from sbt-assembly.
It's published on the community repo:
resolvers += Resolver.url("sbt-plugin-releases",
new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
from sbt-assembly.
Ah, okay. Plans for pushing that to central?
For the record, this is the nicest build.sbt code I could come up with:
excludedFiles in assembly <<= (excludedFiles in assembly) {
(old) => (bases) => old(bases) ++ (bases flatMap (base => (base / "reference.conf").get))
}
assembledMappings in assembly <<= (assembledMappings in assembly) map {
(old) => (f) => old(f) :+ (file("src/main/resources/reference.conf"), "reference.conf")
}
Going to write some actual merging to produce our reference.conf
next.
from sbt-assembly.
Plans for pushing that to central?
I don't think so. The next version of sbt would have it resolved by default and it's only sbt that needs it.
from sbt-assembly.
Related Issues (20)
- Inconsistent merge strategy logging vs counts
- Logback does not work with über-JAR HOT 1
- Migrate to `com.github.sbt`? HOT 1
- Assembly no longer creating directories defined in assemblyOutputPath HOT 4
- executable jar args
- Concatenating files without a newline HOT 4
- META-INF/javax.annotation.processing.Processor is included empty when shading is enabled - log4j HOT 1
- Add setting to allow adding arbitrary files to output Jar HOT 1
- Merge error not comprehensible HOT 3
- Definition of a repeatable build HOT 1
- InvalidPathException on Assembly 2.1.1 HOT 13
- Current alternative to assembledMappings HOT 6
- Document log4j2 plugins custom merge strategy HOT 2
- sbt clean assembly fails
- issue with zip64 headers in jars generated using sbt-assembly HOT 1
- Files from project's sources overwrite merged dependencies (2.0.0 regression)
- Shading breaks META-INF/services (1.2.0 regression) HOT 1
- Exception thrown "pomProperties" is null
- Abort build if shading fails HOT 1
- question about Mappings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sbt-assembly.