You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Heix, Andreas" <an...@sap.com> on 2010/08/25 09:07:42 UTC

How can I write the complete environment of a maven build into a file for later reference / debugging?

Hi,

we use mvn on both local developer's machines as well as some central CI servers and machines reserved to do the "real" release builds. This means different OS, Nexus instances used as proxy and so on.

When we encounter the "it works on my machine", it takes us some time to spot the differences which might be the cause for this. It seems that the class org.apache.maven.execution.MavenSession contains many of the interesting parameters, but I have not found a way to "dump" its status so we could compare it with another MavenSession instance from another machine.

I did some reverse engineering, which does the job for us, but it is - well, just reverse engineering. Especially the filtering is really depending on the non-API internals of the classes. Is there a nicer solution available from the Maven core?

Thanks and kind regards
Andreas




	public static void dumpMavenSessionAsXML(MavenSession session, OutputStream outputStream, boolean filtered) {
		
		XStream xstream = new XStream(new DomDriver(UTF8_ENCODING));
		if (filtered) {
			xstream.omitField(DefaultPlexusContainer.class, "containerContext");
			xstream.omitField(DefaultPlexusContainer.class, "classWorld");
			xstream.omitField(DefaultPlexusContainer.class, "componentRegistry");
			xstream.omitField(DefaultPlexusContainer.class, "containerRealm");
			xstream.omitField(DefaultPlexusContainer.class, "loggerManager");
			
			xstream.omitField(MavenSession.class, "pluginContextsByProjectAndPluginKey");
			xstream.omitField(MavenSession.class, "result");
			xstream.omitField(MavenProject.class, "mavenProjectBuilder");
			xstream.omitField(MavenProject.class, "repositorySystem");
			xstream.omitField(MavenProject.class, "projectBuilderConfiguration");
			
			xstream.omitField(DefaultMavenExecutionRequest.class, "localRepository");
			xstream.omitField(DefaultMavenExecutionRequest.class, "repositoryCache");
			xstream.omitField(DefaultMavenExecutionRequest.class, "transferListener");
			xstream.omitField(DefaultMavenExecutionRequest.class, "projectBuildingRequest");
			xstream.omitField(DefaultMavenExecutionRequest.class, "executionListener");
		}	
		
		xstream.toXML(session, outputStream);
	}




Pflichtangaben/Mandatory Disclosure Statements: 
http://www.sap.com/company/legal/impressum.epx
Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank.
This e-mail may contain trade secrets or privileged, undisclosed, or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying, or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How can I write the complete environment of a maven build into a file for later reference / debugging?

Posted by eldad_ak <el...@yahoo.com>.
Hi,
I suggest adding the maven-antrun-plugin and using the <echoporperties> task
and then an <exec> task where you simply call 'set' (on windows) or 'env'
and 'set' (on unix) and redirect the output as needed. It's not so fancy,
but it gets the job done.

Eldad
-- 
View this message in context: http://maven.40175.n5.nabble.com/How-can-I-write-the-complete-environment-of-a-maven-build-into-a-file-for-later-reference-debugging-tp2652250p2652398.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org