Is there a maven plugin that can diff files and output the result to file? - maven-2

I've been working on integration-tests for a Java web service. The integration test now sends SOAP-requests to the server which are asserted via the SoapUI-plugin and for each of the SOAP-requests an xml file is produced and saved (a part of the integration-test phase).
Is there a plugin that allows me to diff the xml files that has been output and saved against a similar set of xml files that were produced in an earlier run? The idea is to diff xml files output from the previous release version with the current version to make sure the expected changes have been made to the xml files.
I hope my question is clear enough. Thanks in advance
EDIT: The xml files that I would like to compare against will be copied in to a directory (lets say, target/compare_against) by the person that is running the test. They are not under SCM.

The only plugin that will do diffs “natively” is the scm plugin, and that only if you've got the other version of the file committed to a repository. (I say “natively” because it probably just runs the diff in a subprocess internally anyway.) I mention this because your question wasn't really clear about how you were keeping around the data from the previous runs.
If that doesn't fit, you'll find the antrun plugin easiest.

I haven't seen any Maven plugins that will do it. You might be able to find an Ant Task (maybe this one?) to do it and use the antrun plugin to run the task. I did see some stuff about xmldiff and Maven/Ant integration but, it's kind of bare.

Related

How to add the target jar as a test resource of the same project?

I'm developing a Solr plugin and using the Solr test-framework I place a test SOLR_HOME dir under test/resources with /conf/ and /lib . Now the framework inistantiates a SolrCore and loads my plugin from /lib. Not an issue to output the jar of the plugin to /lib, but the issue is that the plugin is not yet available since it still needs to past the test (chicken and the egg).
How do you recommend solving this? I see those options:
Create another project for the tests with a dependency on the plugin, and in it run the tests. Simple enough, but how do I ensure that everytime the plugin is built also the tests of this other project is built? The point of the automated tests at every build is to having a new plugin jar which breaks the tests.
In dp4j pom.xml I build the project on 2 phases, in the 1st I <include> only the annotation processors while in the other I compile the tests which rely on the annotation processors compiled in the eariler phase.
I'm in favor of 2 since copy-pasting the configuration doesn't seem a bad option, and makes it seem less complicated than it probably is. I don't remember if I had asked about it here - what do you recommend? Any other case studies /working code to look at?
there's a 3rd. most probably best solution ~ do nothing!
I was under the impression that the Solr Testframework need to load my plugin from /lib but apparently it doesn't need to, it can load it from test-classes, all on its own!

maven clearcase integration analysis

I am planning to integrate Clearcase UCM(under dynamic view) with Maven.
1) I found that Maven SCM is partially
implemented for clearcase. Is there
are any still issue with this? what is
meaning partailly implemented SCM?
2) How compatable Clearcase with
Maven?
3)Any issues or limitation with this 2
tools integration?
4)Maven docs says that it is not
possible to use SCM plugin features
like creating tags (applying labels),
creating Change logs, and so on.
5) where can i find good document to integrate Maven with clearcase?. Apache site have given, but it is not very clear for beginners.
There are very few documentations on Maven with UCM ClearCase, and limitations like the ones described in SCM Implementation: ClearCase:
The ClearCase SCM provider uses snapshot views.
(so no dynamic view for instance, but you mention tags, which should be implemented as UCM baseline)
As no SCM metadata can be accessed, it is not possible to use SCM plugin features like creating tags (applying labels), creating changelogs, and so on.
Another limitation, in this thread:
Hi. I have been able to integrate Hudson and ClearCase without too much trouble using a Windows machine. Downloading source code from a given baseline or stream is fine.
The problem comes if you try to use some ant tasks for checking out a pom file, make some changes ( like updating some version numbers ) and then checkin the modified pom file before starting to build.
No matter if I use an ant script with ClearCase tasks, or internal Java classes, or even a maven-release-plugin for Hudson that tries to do this kind of job, I always end with the following error :
cleartool: Error: Type manager "_xml2" failed create_version operation
when trying to checking a XML file.
Which kind of integration are you looking for?
If it's about identifying and documenting the changes between UCM baselines, streams, activities and components, you can use CompBL - a complemntary add-on for ClearCase.
It's an easy to install add-on yet very powerful.
Cheers
This is an error thrown by clearcase while checking in xml files, if xml file is exceeding more then /1000 characters.
try changing xml file type, this will resolve the issue "cleartool chtype file file.xml"

Binary comparison of images/files using MSBuild or CCNet

At my current client, we are using CruiseControl.Net for continuous integration. We are building website projects using MSBuild.
The issue that I have run up against is the following: We want to move all code and associated DLLs with every release. However, we also have (sometimes) hundreds of megs of files and images that are unchanged. In the CC.Net world, I will probably split these in to two different builds, one for a site and the other for static content.
What I would like to know is if anyone knows of an MSBuild or CCNet plugin that will allow me to do a binary diff on my static content? I'd like to be able to know if an image has chnaged or been added and then package only the changed/added content up and push them to a QA environment.
I did that with svn logs and MsBuild tasks.
Every time I Deploy the website, I save somewhere the revision number (basically in a flat file).
Then at the next Build-Deploy, I will do a svn log to see the diff between the latest release and now. Then my MsBuild Task takes the svn log xml output, parses it and outputs in another file the interesting static files added/modified/deleted.
Then the usual tasks come in and process only the modified files instead of every file.
That was a huge piece of work (above all with internal logic : our "static" contents are dynamically generated for each environment, each partner and each theme) but it was worth it.
Either way, you can try using a ChecksumCopy, but I don't know if it's less expensive...

Get full name of an artifact in Maven

I need to know the complete filename of a specific artifact in Maven. I looked at versions-maven-plugin but it seems to change the pom itself. Is there another way to reach my goal? I want to store the complete artifact name in a property so I can pick it up in Java code.
Normally you have your dependencies and let maven do all the work of retrieving the files from the repository for you.
But you want to use it in your Java code - what Java code?
Are you writing your own mojo that will be doing something during the install phase of your lifecycle?
Then you should be able to access the artifacts that are currently being processed, from there it's not a problem to get the filename.
But maybe you've got just the groupId, artifactId, version and type of an already existing artifact.
With these informations it should be no problem to navigate to your local maven repository, open the directory: groupId/artifactId/version and look what files you've got there. Usually there should be your .pom a .jar, maybe a md5-hashsum and some maven-metadata. If you're not sure which file's the interesting one: take that one with the biggest filesize.

QuickBuild: How can I create a builder to open a tarball package (tar.gz) whose name will change with each version?

I'm using PMEase QuickBuild to perform automated builds of our Maven2 projects and a nightly sanity test to ensure nothing is broken.
The test needs to untar packages which are created by the automated Maven2 projects. The problem is that the package names change frequently due to project versions being incremented all the time.
Does anyone know how I can configure QuickBuild to pick up the version (ideally from the POM file of the individual components), if this is possible at all?
I don't know if this is an option for you but it looks like you can do it the other way around. Quoting Build with Maven:
Control build version
If you want to control the build
version from QuickBuild side, please
follow below steps:
Change the POM file and define the project version as
${buildVersion}. Do not forget to
commit the file into your SCM after
change.
Define a build property like below when define the Maven build
step:
buildVersion=${build.version}
There are maybe other options but I must admit that my knowledge (zero) of QuickBuild is very limited
I created a work around to this issue by having QuickBuild execute a shell script which did the untarring by using wildcards, similar to the following (to avoid computing the exact version):
tar xzf filename-*.tar.gz
I couldn't figure out how to do this in QuickBuild, so I offloaded the work to the shell script.