werken 2002/06/25 08:58:05
Modified: src/java/org/apache/maven/app Maven.java
Added: src/templates/build/plugins/core plugin.jelly
Log:
The further adventures of a plugin.
Revision Changes Path
1.15 +42 -1 jakarta-turbine-maven/src/java/org/apache/maven/app/Maven.java
Index: Maven.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/app/Maven.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Maven.java 25 Jun 2002 13:54:50 -0000 1.14
+++ Maven.java 25 Jun 2002 15:58:05 -0000 1.15
@@ -94,6 +94,8 @@
import java.io.IOException;
import java.io.PrintStream;
+import java.net.URL;
+import java.net.URLClassLoader;
import java.net.MalformedURLException;
import java.util.List;
@@ -710,10 +712,26 @@
loadPluginProperties(name);
+ // Setup the classloader that adds the plugin's own
+ // directory/jar to the classloader available to
+ // jelly. Don't forget to set it back to how it
+ // was. Leave nothing but footprints, take nothing
+ // but photographs.
+
+ ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+
+ ClassLoader cl = new URLClassLoader(new URL[]{getPluginDir(name).toURL()},
+
getAntProject().getClass().getClassLoader() );
+
+ // Thread.currentThread().setContextClassLoader(cl);
+
JellyUtils.runScript(pluginScript,
getPluginDir(name).toURL(),
getJellyContext(),
getXMLOutput());
+
+ // Thread.currentThread().setContextClassLoader(oldCl);
+
}
/** Load the properties for the specified plugin.
@@ -1220,9 +1238,32 @@
System.err.println("Goal \"" + e.getGoalName()
+ "\" does not exist in this project.");
}
+ catch (UnattainableGoalException e)
+ {
+ System.err.println("BUILD FAILED");
+ Throwable rootCause = e.getRootCause();
+
+ if (rootCause != null)
+ {
+ System.err.println(rootCause.getLocalizedMessage());
+ }
+ else
+ {
+ System.err.println(e.getLocalizedMessage());
+ }
+ }
catch (JellyException e)
{
- System.err.println(e.getLocalizedMessage());
+ Throwable rootCause = e.getCause();
+
+ if ( rootCause != null )
+ {
+ System.err.println(rootCause.getLocalizedMessage());
+ }
+ else
+ {
+ System.err.println(e.getLocalizedMessage());
+ }
}
catch (Exception e)
{
1.1
jakarta-turbine-maven/src/templates/build/plugins/core/plugin.jelly
Index: plugin.jelly
===================================================================
<?xml version="1.0"?>
<project xmlns:j="jelly:core">
<path id="maven.compile.src.set">
<pathelement location="${pom.build.SourceDirectory}"/>
</path>
<path id="maven.dependency.classpath">
<j:forEach var="dep" items="${pom.dependencies}">
<pathelement location="${dep.jar}"/>
</j:forEach>
</path>
<!-- ================================================================== -->
<!-- prepare-filesystem -->
<!-- ================================================================== -->
<goal name="maven:prepare-filesystem">
<mkdir dir="${maven.build.dest}"/>
</goal>
<!-- ================================================================== -->
<!-- compile -->
<!-- ================================================================== -->
<goal name="maven:compile"
prereqs="maven:prepare-filesystem">
<property name="cp" refid="maven.dependency.classpath"/>
<echo message="CP: ${cp}"/>
<javac
destdir="${maven.build.dest}"
excludes="**/package.html"
debug="${maven.compile.debug}"
deprecation="${maven.compile.deprecation}"
optimize="${maven.compile.optimize}">
<src>
<path refid="maven.compile.src.set"/>
</src>
<classpath>
<path refid="maven.dependency.classpath"/>
<pathelement path="${maven.build.dest}"/>
</classpath>
</javac>
</goal>
<!-- ================================================================== -->
<!-- jar resources -->
<!-- ================================================================== -->
<goal name="maven:jar-resources">
<!-- Copy any resources that must be present in the deployed
JAR file.
-->
<echo>
Copy resources into destination directory for deployment
in the JAR.
</echo>
<copy todir="${maven.build.dest}">
<fileset dir="${maven.jarResources.basedir}">
<patternset refid="maven.jar.resources.set"/>
</fileset>
</copy>
</goal>
<!-- ================================================================== -->
<!-- jar -->
<!-- ================================================================== -->
<goal name="maven:jar"
description="Create the deliverable jar file."
prereqs="maven:test,maven:jar-resources">
<jar
jarfile="${maven.build.dir}/${maven.final.name}.jar"
basedir="${maven.build.dest}"
excludes="${maven.jar.excludes}">
<metainf dir="${basedir}">
<include name="LICENSE.txt"/>
</metainf>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Created-By" value="Apache Jakarta Maven"/>
<section name="${maven.package}">
<attribute name="Specification-Title" value="${maven.id}"/>
<attribute name="Specification-Version" value="${maven.currentVersion}"/>
<attribute name="Specification-Vendor" value="${maven.organization}"/>
<attribute name="Implementation-Title" value="${maven.package}"/>
<attribute name="Implementation-Version" value="${maven.currentVersion}"/>
<attribute name="Implementation-Vendor" value="${maven.organization}"/>
</section>
</manifest>
</jar>
</goal>
<!-- ================================================================== -->
<!-- check-source -->
<!-- ================================================================== -->
<goal name="maven:check-source">
<!--
ignorePublicInInterface="${maven.checkstyle.ignore.public.in.interface}"
-->
<checkstyle
lcurlyType="${maven.checkstyle.lcurly.type}"
lcurlyMethod="${maven.checkstyle.lcurly.method}"
lcurlyOther="${maven.checkstyle.lcurly.other}"
rcurly="${maven.checkstyle.rcurly}"
parenPad="${maven.checkstyle.paren.pad}"
allowTabs="${maven.checkstyle.allow.tabs}"
allowProtected="${maven.checkstyle.allow.protected}"
allowPackage="${maven.checkstyle.allow.package}"
allowNoAuthor="${maven.checkstyle.allow.no.author}"
maxLineLen="${maven.checkstyle.max.line.len}"
tabWidth="${maven.checkstyle.tab.width}"
ignoreLineLengthPattern="${maven.checkstyle.ignore.line.len.pattern}"
maxMethodLen="${maven.checkstyle.max.method.len}"
maxConstructorLen="${maven.checkstyle.max.constructor.len}"
maxFileLen="${maven.checkstyle.max.file.len}"
ignoreImportLen="${maven.checkstyle.ignore.import.len}"
memberPattern="${maven.checkstyle.member.pattern}"
publicMemberPattern="${maven.checkstyle.public.member.pattern}"
paramPattern="${maven.checkstyle.param.pattern}"
constPattern="${maven.checkstyle.const.pattern}"
staticPattern="${maven.checkstyle.static.pattern}"
typePattern="${maven.checkstyle.type.pattern}"
methodPattern="${maven.checkstyle.method.pattern}"
localVarPattern="${maven.checkstyle.local.var.pattern}"
headerFile="${maven.checkstyle.header.file}"
headerLinesRegexp="${maven.checkstyle.header.lines.regexp}"
headerIgnoreLine="${maven.checkstyle.header.ignore.line}"
javadocScope="${maven.checkstyle.javadoc.scope}"
requirePackageHtml="${maven.checkstyle.require.package.html}"
ignoreImports="${maven.checkstyle.ignore.imports}"
illegalImports="${maven.checkstyle.illegal.imports}"
ignoreWhitespace="${maven.checkstyle.ignore.whitespace}"
ignoreCastWhitespace="${maven.checkstyle.ignore.cast.whitespace}"
ignoreBraces="${maven.checkstyle.ignore.braces}"
failOnViolation="${maven.checkstyle.fail.on.violation}"
cacheFile="${maven.checkstyle.cache.file}" >
<fileset dir="${maven.build.sourceDirectory}"
includes="${maven.checkstyle.includes}"
excludes="${maven.checkstyle.excludes}"/>
<formatter type="xml" toFile="${maven.build.dir}/checkstyle-raw-report.xml"/>
<formatter type="plain" toFile="${maven.build.dir}/checkstyle-raw-report.txt"/>
</checkstyle>
<dvsl
basedir="${basedir}"
style="${maven.home}/stylesheets/checkstyle.dvsl"
toolboxfile="${maven.home}/stylesheets/toolbox.props"
in="${maven.build.dir}/checkstyle-raw-report.xml"
out="${maven.gen.docs}/checkstyle-report.xml">
<classpath>
<path refid="maven-classpath"/>
</classpath>
</dvsl>
</goal>
<!-- ================================================================== -->
<!-- clean -->
<!-- ================================================================== -->
<goal name="maven:clean">
<delete dir="${maven.build.dir}"/>
<delete dir="${maven.test.reportsDirectory}"/>
</goal>
</project>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>