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

control which jar is added last (or first) so the correct MANIFEST.MF is present #21

Closed
tbee opened this issue Dec 7, 2013 · 4 comments
Assignees
Milestone

Comments

@tbee
Copy link

tbee commented Dec 7, 2013

Right now I have two jars, each with a MANIFEST.MF and a MANIFEST.MF in my src/main/resources/META-INF directory. It cannot control which MANIFEST.MF end up in the shadow.jar. Ideally it per default should be the one in my src directory.

@ghost ghost assigned johnrengelman Dec 11, 2013
@johnrengelman
Copy link
Owner

Do you have an example project for this?
The code will include the MANIFEST.MF file from the project's JAR before anything else.

So if you have a project foo and that includes a dependency bar, and the foo project has

jar {
  manifest {
     ...
  }
}

then that Manifest will be in the Shadow jar. However, if you're aren't defining a manifest file in your project, then it's going to include whichever manifest file it encounters first while processing the dependency jars.
If you want to control which one is include, then you should use the filtering configuration to include it only from the jar you want. See https://github.com/johnrengelman/shadow/blob/master/it/filter-artifact-contents/build.gradle

@johnrengelman
Copy link
Owner

However, there is some additional work that needs to be done to the filtering to make them easier to use. Layering various excludes/includes at different levels doesn't always work the greatest.

@tbee
Copy link
Author

tbee commented Dec 14, 2013

I'm currently using it to build JFXtras (http://jfxtras.org/), source are in github (link is on the webpage). I have not tried using the jar thingy, I'm a Gradle newbie, I do have a MANIFEST.MF file in the resource directory.

Tom

On 2013-12-11 21:39, John Engelman wrote:

Do you have an example project for this?
The code will include the |MANIFEST.MF| file from the project's JAR before anything else.

So if you have a project |foo| and that includes a dependency |bar|, and the |foo| project has

|jar {
manifest {
...
}
}
|

then that Manifest will be in the Shadow jar. However, if you're aren't defining a manifest file in your project, then it's going to include whichever manifest file it encounters first while processing the dependency jars.
If you want to control which one is include, then you should use the filtering configuration to include it only from the jar you want. See https://github.com/johnrengelman/shadow/blob/master/it/filter-artifact-contents/build.gradle


Reply to this email directly or view it on GitHub #21 (comment).

@tbee
Copy link
Author

tbee commented Dec 16, 2013

Thanks. The jar task worked!

On 2013-12-11 21:39, John Engelman wrote:

Do you have an example project for this?
The code will include the |MANIFEST.MF| file from the project's JAR before anything else.

So if you have a project |foo| and that includes a dependency |bar|, and the |foo| project has

|jar {
manifest {
...
}
}
|

then that Manifest will be in the Shadow jar. However, if you're aren't defining a manifest file in your project, then it's going to include whichever manifest file it encounters first while processing the dependency jars.
If you want to control which one is include, then you should use the filtering configuration to include it only from the jar you want. See https://github.com/johnrengelman/shadow/blob/master/it/filter-artifact-contents/build.gradle


Reply to this email directly or view it on GitHub #21 (comment).

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

2 participants