[ 
https://issues.apache.org/jira/browse/S4-72?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13411681#comment-13411681
 ] 

Matthieu Morel commented on S4-72:
----------------------------------

Note that you'll need to modify existing build.gradle files for existing 
projects, by applying the following diff:
{code}
+// external dependencies will be available in the /lib directory of the s4r
+task copyDependenciesToLib(type: Copy) {
+    into project.libsDir.path+"/lib"
+    from configurations.runtime
+}
+
+// app jar will be available from the /app directory of the s4r
+task buildProjectJar() {
+       dependsOn jar {
+               destinationDir file(project.libsDir.path + "/app")
+               from sourceSets.main.output
+       }
+}
+
+
 task s4r(type: Jar) {
-
-   if (rootProject.hasProperty("appName")) {
+       if (rootProject.hasProperty("appName")) {
        archiveName= "$appName"+".s4r"
    }
-   dependsOn jar
-   from { appDependencies.collect { it.isDirectory() ? it : zipTree(it) } }
-   from { configurations.archives.allArtifacts.files.collect { zipTree(it) } }
+   dependsOn cleanCopyDependenciesToLib, copyDependenciesToLib, 
cleanBuildProjectJar, buildProjectJar
+   from { project.libsDir }
    manifest = project.manifest
+   extension = 's4r'
+   exclude '*.s4r'
{code}
                
> Resource loading from S4R
> -------------------------
>
>                 Key: S4-72
>                 URL: https://issues.apache.org/jira/browse/S4-72
>             Project: Apache S4
>          Issue Type: Improvement
>    Affects Versions: 0.5
>            Reporter: Daniel Gómez Ferro
>             Fix For: 0.5
>
>
> S4RLoader should load resources from jars. This could be accomplished 
> overriding {{findResource()}} or directly 
> {{getResource()/getResourceAsStream()}}.
> User resources should also take precedence over dependencies resources. Right 
> now dependencies are exploded and packaged on a single JAR causing all 
> resources to be at the same level, possibly conflicting with each other. 
> There are a couple of options to solve this:
>    * Specify a directory for user resources which will be searched before any 
> other directory
>    * Don't explode dependencies, packaging them as JARs. Only user resources 
> would be at top level

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to