My project is depending on many ZIP resources.
With "maven-dependency-plugin" and its "unpack-dependencies", I kown how to unpack each dependency.
But (for different reasons I cannot explain here), I have to unpack the dependencies in a specific order (*).
Is it possible to unpack in a specific order, or is it possible to manage the dependencies order ?
Thanks,
Xavier
(*) there are some files with the same names, and I have to overwrite some files from one dependency with other from another dependency ....
[EDIT][SOLUTION]
Thanks for answers.
I found a solution with copy-maven-plugin.
Here is an example of solution for my problem :
https://gist.github.com/4164769
As in most cases with Maven, I think there are several ways to do this, and you'll have to find the most elegant way yourself. I'll give you an idea of how I'd get started.
First, you can use the dependency plugin's unpack mojo to unpack a specific set of artifact; you name the artifacts specifically in the configuration of the execution. It's possible that you can name more than one here and they will be processed in order. However, if that doesn't work, you can always configure as many executions of this mojo as necessary, and then order those executions in your pom itself, which DOES control ordering. Note, you can configure the unpack target on a per execution basis too, which may help you.
Another usefull tool that might apply here is the assembly plugin with a custom assembly descriptor. The assembly, like the unpack mojo discussed above, can be configured to handle specific artifacts, rather than just all of them, and the granularity and ordering of the processing is highly flexible.
Related
I'm looking for information about Gradle dependencies, similar to this question:
What is the Gradle artifact dependency graph command?
but with a narrower scope. I'm wondering about functionality that Maven has for analyzing dependencies, and whether or not Gradle includes something similar. Specifically, Maven can scan your source code and then compare that to your declared dependencies, and determine (roughly) if you have dependencies declared that you aren't using and/or if you're using dependencies that you haven't declared (due to issues related to Turing completeness, this analysis may include false positives/negatives, but I generally find it to be incredibly useful regardless). Does Gradle have anything similar? So far I haven't been able to find anything.
Such a thing is not shipped with Gradle at least as far as I know.
You best bet is to search through Google and / or plugins.gradle.org for finding a plugin that does what you want.
I for a short period did this for you and found this one which might be what you want: https://plugins.gradle.org/plugin/com.intershop.gradle.dependencyanalysis
I have no idea about its quality or anything, I just searched through plugins.gradle.org, I don't know or ever used that plugin.
I am using Maven to build my project. There are lot of dependencies which are in provided and runtime scope. The build size is large and I want to remove the unwanted dependencies. So is there any way in which I can check which dependencies are unwanted.
The best way to minimize dependencies to the ones you really need is to not embed that dependencies. If you simply use the maven-bundle-plugin on your code it will create Import-Package statements for the code you really need. This might even give you a good hint on what dependencies you might be able to exclude for embedding.
In general in OSGi the goal should be to not have that many dependencies in the first place. If you use libraries with extensive dependencies then your should question the quality of these.
I want to set the time stamp of the classes and resource in a maven module, just before it's built into the jar.
I guess I can use the maven-antrun-plugin, but I'd like to see if there are better ideas.
Does anyone have an idea?
Let me add more details for the reason I need this capability.
When we build a new version for the product, we also build a patch install which compares all artifacts of previous build to current, and packages only the ones which differ.
Jars (and any zip based archive) might have the same content, but time stamp of classes and resources are part of the metadata, and cause the diff to show jars differ (when in fact, the content is identical). I want to hack the jar packing and set all classes times tamp to be constant (like 1/1/2000 00:00).
I hope this explains my need.
Well, the best solution is to adapt your tool that compute the diff to go have a look deeper in the jar ;)
I am afraid there is no other way than using the a ant file with the touch task to reset the file date. There is no existing plugin that sets the file date.
You could also write your own maven plugin and contribute it to the community but it is probably a bit overkill...
HIH
M.
I just want to share what I decided to do.
I will not touch the maven build, and let it build the jars as before.
What I did is implement a script in my build to compare the jars. The logic of this script is simple:
Check arguments (jars exist)
Extract jars to a temp folder (with a unique name)
Run a diff on both folders
Cleanup
Exit with the relevant exit code (0 if same. 1 if differ)
I hope this is useful.
I've searched for hours but no artifactId and version information for "libopencv_java.so" and "libnative_camera_r2.2.2.so".. I know how to add dependency into pom.xml to be included in lib/armeabi in .apk, but I just cannot find the correct information.. The pox.xml keeps complaining
"Missing artifact org.opencv:libnative_camera_r2.2.2:so:2.2.2
Missing artifact org.opencv:libopencv_java:so:1.0"
Thank you so much~!!
These are native non-Java libraries. They aren't normally handled by Maven. If you would like to use static objects in your module, I suggest you have something like ${basedir}/lib and place your static libraries in there. Add the directory as a <resource/> as well and have it included in you jar. I think it should be possible to load the .so from within the jar. This is one option.
Another option would be, (if you really, really must re-use the .so-s across modules), to extract them to a separate module and have your module depend on that one.
Either way, you'll need to do quite a bit of magic, which isn't covered by Maven by default.
Is it possible to run the maven-compiler-plugin in process-sources only for specific packages?
I know the correct way to do this is to extract the needed classes in a extra module but this seems to be a huge overhead for just two classes.
If one wants to know it is needed for the fornax-oaw-m2-plugin