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: [email protected]
For additional commands, e-mail: [email protected]