You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2008/03/27 03:04:23 UTC
svn commit: r641686 - in /activemq/camel/trunk:
tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/
tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/
Author: ningjiang
Date: Wed Mar 26 19:04:22 2008
New Revision: 641686
URL: http://svn.apache.org/viewvc?rev=641686&view=rev
Log:
Fixed the other components CS errors
Modified:
activemq/camel/trunk/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/MyBean.java
activemq/camel/trunk/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/MyConverter.java
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
Modified: activemq/camel/trunk/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/MyBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/MyBean.java?rev=641686&r1=641685&r2=641686&view=diff
==============================================================================
--- activemq/camel/trunk/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/MyBean.java (original)
+++ activemq/camel/trunk/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/MyBean.java Wed Mar 26 19:04:22 2008
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Modified: activemq/camel/trunk/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/MyConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/MyConverter.java?rev=641686&r1=641685&r2=641686&view=diff
==============================================================================
--- activemq/camel/trunk/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/MyConverter.java (original)
+++ activemq/camel/trunk/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/MyConverter.java Wed Mar 26 19:04:22 2008
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Modified: activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java?rev=641686&r1=641685&r2=641686&view=diff
==============================================================================
--- activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java (original)
+++ activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java Wed Mar 26 19:04:22 2008
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -59,6 +58,25 @@
* Subdirectory for report.
*/
protected static final String SUBDIRECTORY = "cameldoc";
+ //
+ // For running Camel embedded
+ //-------------------------------------------------------------------------
+ //
+ /**
+ * The duration to run the application for which by default is in milliseconds.
+ *
+ * @parameter expression="2s"
+ * @readonly
+ */
+ protected String duration;
+ /**
+ * Whether we should boot up camel with the META-INF/services/*.xml to generate the DOT file
+ *
+ * @parameter expression="true"
+ * @readonly
+ */
+ protected boolean runCamel;
+
private String indexHtmlContent;
/**
* Reference to Maven 2 Project.
@@ -110,24 +128,6 @@
* @component
*/
private Renderer renderer;
- //
- // For running Camel embedded
- //-------------------------------------------------------------------------
- //
- /**
- * The duration to run the application for which by default is in milliseconds.
- *
- * @parameter expression="2s"
- * @readonly
- */
- protected String duration;
- /**
- * Whether we should boot up camel with the META-INF/services/*.xml to generate the DOT file
- *
- * @parameter expression="true"
- * @readonly
- */
- protected boolean runCamel;
/**
* @param locale report locale.
@@ -159,8 +159,7 @@
this.execute(this.buildDirectory, Locale.getDefault());
try {
writeIndexHtmlFile("index.html", indexHtmlContent);
- }
- catch (IOException e) {
+ } catch (IOException e) {
throw new MojoExecutionException("Failed: " + e, e);
}
}
@@ -175,12 +174,10 @@
Sink kitchenSink = getSink();
if (kitchenSink != null) {
kitchenSink.rawText(indexHtmlContent);
- }
- else {
+ } else {
writeIndexHtmlFile("index.html", indexHtmlContent);
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
final MavenReportException ex = new MavenReportException(e.getMessage());
ex.initCause(e.getCause());
throw ex;
@@ -191,14 +188,13 @@
* Executes DOT generator.
*
* @param outputDir report output directory.
- * @param locale report locale.
+ * @param locale report locale.
* @throws MojoExecutionException if there were any execution errors.
*/
protected void execute(final File outputDir, final Locale locale) throws MojoExecutionException {
try {
runCamelEmbedded(outputDir);
- }
- catch (DependencyResolutionRequiredException e) {
+ } catch (DependencyResolutionRequiredException e) {
throw new MojoExecutionException("Failed: " + e, e);
}
outputDir.mkdirs();
@@ -209,14 +205,13 @@
if (graphvizOutputTypes == null) {
if (graphvizOutputType == null) {
graphvizOutputTypes = DEFAULT_GRAPHVIZ_OUTPUT_TYPES;
- }
- else {
- graphvizOutputTypes = new String[]{graphvizOutputType};
+ } else {
+ graphvizOutputTypes = new String[] {graphvizOutputType};
}
}
try {
for (int i = 0; i < files.size(); i++) {
- File file = (File) ((List) files).get(i);
+ File file = (File)((List)files).get(i);
StringWriter buffer = new StringWriter();
PrintWriter out = new PrintWriter(buffer);
@@ -246,11 +241,9 @@
}
writeIndexHtmlFile(name, content);
}
- }
- catch (CommandLineException e) {
+ } catch (CommandLineException e) {
throw new MojoExecutionException("Failed: " + e, e);
- }
- catch (IOException e) {
+ } catch (IOException e) {
throw new MojoExecutionException("Failed: " + e, e);
}
}
@@ -271,8 +264,7 @@
mojo.setPluginContext(getPluginContext());
try {
mojo.executeWithoutWrapping();
- }
- catch (Exception e) {
+ } catch (Exception e) {
getLog().error("Failed to run Camel embedded: " + e, e);
}
}
@@ -293,14 +285,12 @@
out.println();
if (content == null) {
out.write("<p>No EIP diagrams available</p>");
- }
- else {
+ } else {
out.write(content);
}
out.println("</body>");
out.println("</html>");
- }
- finally {
+ } finally {
String description = "Failed to close html output file";
close(out, description);
}
@@ -330,8 +320,7 @@
if (closeable != null) {
try {
closeable.close();
- }
- catch (IOException e) {
+ } catch (IOException e) {
getLog().warn(description + ": " + e);
}
}
@@ -370,8 +359,7 @@
int idx = name.lastIndexOf(".");
if (idx > 0) {
return name.substring(0, idx);
- }
- else {
+ } else {
return name;
}
}
@@ -379,8 +367,7 @@
private void appendFiles(List<File> output, File file) {
if (file.isDirectory()) {
appendDirectory(output, file);
- }
- else {
+ } else {
if (isValid(file)) {
output.add(file);
}
@@ -407,16 +394,13 @@
String line = reader.readLine();
if (line == null) {
break;
- }
- else {
+ } else {
out.println(line);
}
}
- }
- catch (IOException e) {
+ } catch (IOException e) {
throw new MojoExecutionException("Failed: " + e, e);
- }
- finally {
+ } finally {
close(reader, "cmapx file");
}
}
@@ -428,10 +412,7 @@
* @return resource bundle
*/
protected ResourceBundle getBundle(final Locale locale) {
- return ResourceBundle.getBundle(
- "camel-maven-plugin",
- locale,
- this.getClass().getClassLoader());
+ return ResourceBundle.getBundle("camel-maven-plugin", locale, this.getClass().getClassLoader());
}
protected Renderer getSiteRenderer() {
@@ -448,4 +429,4 @@
protected MavenProject getProject() {
return this.project;
}
-}
\ No newline at end of file
+}
Modified: activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java?rev=641686&r1=641685&r2=641686&view=diff
==============================================================================
--- activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java (original)
+++ activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java Wed Mar 26 19:04:22 2008
@@ -16,9 +16,6 @@
*/
package org.apache.camel.maven;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.codehaus.mojo.exec.AbstractExecMojo;
-
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -28,6 +25,9 @@
import java.util.Arrays;
import java.util.List;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.codehaus.mojo.exec.AbstractExecMojo;
+
/**
* Runs a CamelContext using any Spring XML configuration files found in
* <code>META-INF/spring/*.xml</code> and <code>camel-*.xml</code>
@@ -40,14 +40,6 @@
*/
public class EmbeddedMojo extends AbstractExecMojo {
/**
- * Project classpath.
- *
- * @parameter expression="${project.testClasspathElements}"
- * @required
- * @readonly
- */
- private List classpathElements;
- /**
* The duration to run the application for which by default is in milliseconds.
*
* @parameter expression="-1"
@@ -68,6 +60,15 @@
* @readonly
*/
protected boolean dotEnabled;
+ /**
+ * Project classpath.
+ *
+ * @parameter expression="${project.testClasspathElements}"
+ * @required
+ * @readonly
+ */
+ private List classpathElements;
+
/**
* This method will run the mojo
@@ -75,20 +76,19 @@
public void execute() throws MojoExecutionException {
try {
executeWithoutWrapping();
- }
- catch (Exception e) {
+ } catch (Exception e) {
throw new MojoExecutionException("Failed: " + e, e);
}
}
- public void executeWithoutWrapping() throws MalformedURLException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, MojoExecutionException {
+ public void executeWithoutWrapping() throws MalformedURLException, ClassNotFoundException,
+ NoSuchMethodException, IllegalAccessException, MojoExecutionException {
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
try {
ClassLoader newLoader = createClassLoader(null);
Thread.currentThread().setContextClassLoader(newLoader);
runCamel(newLoader);
- }
- finally {
+ } finally {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
}
@@ -141,7 +141,8 @@
// Implementation methods
//-------------------------------------------------------------------------
- protected void runCamel(ClassLoader newLoader) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, MojoExecutionException {
+ protected void runCamel(ClassLoader newLoader) throws ClassNotFoundException, NoSuchMethodException,
+ IllegalAccessException, MojoExecutionException {
getLog().debug("Running Camel in: " + newLoader);
Class<?> type = newLoader.loadClass("org.apache.camel.spring.Main");
Method method = type.getMethod("main", String[].class);
@@ -149,9 +150,8 @@
getLog().debug("Starting the Camel Main with arguments: " + Arrays.asList(arguments));
try {
- method.invoke(null, new Object[]{arguments});
- }
- catch (InvocationTargetException e) {
+ method.invoke(null, new Object[] {arguments});
+ } catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
throw new MojoExecutionException("Failed: " + t, t);
}
@@ -159,10 +159,9 @@
protected String[] createArguments() {
if (dotEnabled) {
- return new String[]{"-duration", duration, "-outdir", outputDirectory};
- }
- else {
- return new String[]{"-duration", duration};
+ return new String[] {"-duration", duration, "-outdir", outputDirectory};
+ } else {
+ return new String[] {"-duration", duration};
}
}
@@ -172,7 +171,7 @@
int size = classpathElements.size();
URL[] urls = new URL[size];
for (int i = 0; i < size; i++) {
- String name = (String) classpathElements.get(i);
+ String name = (String)classpathElements.get(i);
File file = new File(name);
urls[i] = file.toURL();
getLog().debug("URL: " + urls[i]);
@@ -180,4 +179,4 @@
URLClassLoader loader = new URLClassLoader(urls, parent);
return loader;
}
-}
\ No newline at end of file
+}
Modified: activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java?rev=641686&r1=641685&r2=641686&view=diff
==============================================================================
--- activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java (original)
+++ activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java Wed Mar 26 19:04:22 2008
@@ -16,6 +16,21 @@
*/
package org.apache.camel.maven;
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
@@ -37,25 +52,11 @@
import org.codehaus.mojo.exec.ExecutableDependency;
import org.codehaus.mojo.exec.Property;
-import java.io.File;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
/**
* Runs a CamelContext using any Spring XML configuration files found in
- * <code>META-INF/spring/*.xml</code> and <code>camel-*.xml</code> and starting up the context.
- *
+ * <code>META-INF/spring/*.xml</code> and <code>camel-*.xml</code> and
+ * starting up the context.
+ *
* @goal run
* @requiresDependencyResolution runtime
* @execute phase="test-compile"
@@ -71,7 +72,7 @@
/**
* The maven project.
- *
+ *
* @parameter expression="${project}"
* @required
* @readonly
@@ -79,8 +80,8 @@
protected MavenProject project;
/**
- * The duration to run the application for which by default is in milliseconds.
- * A value <= 0 will
+ * The duration to run the application for which by default is in
+ * milliseconds. A value <= 0 will
*
* @parameter expression="-1"
* @readonly
@@ -88,7 +89,8 @@
protected String duration;
/**
- * The DOT outputd irectory name used to generate the DOT diagram of the route definitions
+ * The DOT outputd irectory name used to generate the DOT diagram of the
+ * route definitions
*
* @parameter expression="${project.build.directory}/site/cameldoc"
* @readonly
@@ -143,7 +145,7 @@
/**
* The main class to execute.
- *
+ *
* @parameter expression="${camel.mainClass}"
* default-value="org.apache.camel.spring.Main"
* @required
@@ -152,7 +154,7 @@
/**
* The class arguments.
- *
+ *
* @parameter expression="${camel.applicationContext}"
*/
private String[] arguments;
@@ -162,7 +164,7 @@
* forked, some system properties required by the JVM cannot be passed here.
* Use MAVEN_OPTS or the exec:exec instead. See the user guide for more
* information.
- *
+ *
* @parameter
*/
private Property[] systemProperties;
@@ -171,7 +173,7 @@
* Deprecated; this is not needed anymore. Indicates if mojo should be kept
* running after the mainclass terminates. Usefull for serverlike apps with
* deamonthreads.
- *
+ *
* @parameter expression="${camel.keepAlive}" default-value="false"
*/
private boolean keepAlive;
@@ -179,7 +181,7 @@
/**
* Indicates if the project dependencies should be used when executing the
* main class.
- *
+ *
* @parameter expression="${camel.includeProjectDependencies}"
* default-value="true"
*/
@@ -192,7 +194,7 @@
* useful when the project is not a java project. For example a mvn project
* using the csharp plugins only expects to see dotnet libraries as
* dependencies.
- *
+ *
* @parameter expression="${camel.includePluginDependencies}"
* default-value="false"
*/
@@ -207,7 +209,7 @@
* the executable's classpath. Whether a particular project dependency is a
* dependency of the identified ExecutableDependency will be irrelevant to
* its inclusion in the classpath.
- *
+ *
* @parameter
* @optional
*/
@@ -225,7 +227,7 @@
* {@link #daemonThreadJoinTimeout} and
* {@link #stopUnresponsiveDaemonThreads} for further tuning.
* </p>
- *
+ *
* @parameter expression="${camel.cleanupDaemonThreads} default-value="true"
*/
private boolean cleanupDaemonThreads;
@@ -246,7 +248,7 @@
* value has been chosen, but this default value <i>may change</i> in the
* future based on user feedback.
* </p>
- *
+ *
* @parameter expression="${camel.daemonThreadJoinTimeout}"
* default-value="15000"
*/
@@ -266,7 +268,7 @@
* <code>Timer</code> fixed, vote for <a
* href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6336543">this
* bug</a>.
- *
+ *
* @parameter expression="${camel.stopUnresponsiveDaemonThreads}
* default-value="false"
*/
@@ -274,7 +276,7 @@
/**
* Deprecated this is not needed anymore.
- *
+ *
* @parameter expression="${camel.killAfter}" default-value="-1"
*/
private long killAfter;
@@ -283,14 +285,15 @@
/**
* Execute goal.
- *
+ *
* @throws MojoExecutionException execution of the main class or one of the
* threads it generated failed.
* @throws MojoFailureException something bad happened...
*/
public void execute() throws MojoExecutionException, MojoFailureException {
if (killAfter != -1) {
- getLog().warn("Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6.");
+ getLog()
+ .warn("Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6.");
}
// lets create the command line arguments to pass in...
@@ -302,7 +305,7 @@
args.add("-d");
args.add(duration);
if (arguments != null) {
- args.addAll(Arrays.asList(arguments));
+ args.addAll(Arrays.asList(arguments));
}
arguments = new String[args.size()];
args.toArray(arguments);
@@ -325,7 +328,8 @@
Thread bootstrapThread = new Thread(threadGroup, new Runnable() {
public void run() {
try {
- Method main = Thread.currentThread().getContextClassLoader().loadClass(mainClass).getMethod("main", new Class[] {String[].class});
+ Method main = Thread.currentThread().getContextClassLoader().loadClass(mainClass)
+ .getMethod("main", new Class[] {String[].class});
if (!main.isAccessible()) {
getLog().debug("Setting accessibility to true in order to invoke main().");
main.setAccessible(true);
@@ -346,7 +350,9 @@
// but it's too late since the termination condition (only daemon
// threads) has been triggered.
if (keepAlive) {
- getLog().warn("Warning: keepAlive is now deprecated and obsolete. Do you need it? Please comment on MEXEC-6.");
+ getLog()
+ .warn(
+ "Warning: keepAlive is now deprecated and obsolete. Do you need it? Please comment on MEXEC-6.");
waitFor(0);
}
@@ -429,7 +435,9 @@
}
// generally abnormal
if (thread.isAlive()) {
- getLog().warn("thread " + thread + " was interrupted but is still alive after waiting at least " + timeoutMsecs + "msecs");
+ getLog().warn(
+ "thread " + thread + " was interrupted but is still alive after waiting at least "
+ + timeoutMsecs + "msecs");
}
}
@@ -437,7 +445,8 @@
long startTime = System.currentTimeMillis();
Set uncooperativeThreads = new HashSet(); // these were not responsive
// to interruption
- for (Collection threads = getActiveThreads(threadGroup); !threads.isEmpty(); threads = getActiveThreads(threadGroup), threads.removeAll(uncooperativeThreads)) {
+ for (Collection threads = getActiveThreads(threadGroup); !threads.isEmpty(); threads = getActiveThreads(threadGroup), threads
+ .removeAll(uncooperativeThreads)) {
// Interrupt all threads we know about as of this instant (harmless
// if spuriously went dead (! isAlive())
// or if something else interrupted it ( isInterrupted() ).
@@ -471,14 +480,20 @@
getLog().warn("thread " + thread + " will be Thread.stop()'ed");
thread.stop();
} else {
- getLog().warn("thread " + thread + " will linger despite being asked to die via interruption");
+ getLog().warn(
+ "thread " + thread
+ + " will linger despite being asked to die via interruption");
}
}
}
if (!uncooperativeThreads.isEmpty()) {
- getLog().warn(
- "NOTE: " + uncooperativeThreads.size() + " thread(s) did not finish despite being asked to "
- + " via interruption. This is not a problem with exec:java, it is a problem with the running code." + " Although not serious, it should be remedied.");
+ getLog()
+ .warn(
+ "NOTE: "
+ + uncooperativeThreads.size()
+ + " thread(s) did not finish despite being asked to "
+ + " via interruption. This is not a problem with exec:java, it is a problem with the running code."
+ + " Although not serious, it should be remedied.");
} else {
int activeCount = threadGroup.activeCount();
if (activeCount != 0) {
@@ -486,7 +501,9 @@
// even log in future
Thread[] threadsArray = new Thread[1];
threadGroup.enumerate(threadsArray);
- getLog().debug("strange; " + activeCount + " thread(s) still active in the group " + threadGroup + " such as " + threadsArray[0]);
+ getLog().debug(
+ "strange; " + activeCount + " thread(s) still active in the group "
+ + threadGroup + " such as " + threadsArray[0]);
}
}
}
@@ -518,7 +535,7 @@
/**
* Set up a classloader for the execution of the main class.
- *
+ *
* @return the classloader
* @throws MojoExecutionException
*/
@@ -532,7 +549,7 @@
/**
* Add any relevant project dependencies to the classpath. Indirectly takes
* includePluginDependencies and ExecutableDependency into consideration.
- *
+ *
* @param path classpath of {@link java.net.URL} objects
* @throws MojoExecutionException
*/
@@ -545,7 +562,9 @@
Iterator iter = this.determineRelevantPluginDependencies().iterator();
while (iter.hasNext()) {
Artifact classPathElement = (Artifact)iter.next();
- getLog().debug("Adding plugin dependency artifact: " + classPathElement.getArtifactId() + " to classpath");
+ getLog().debug(
+ "Adding plugin dependency artifact: " + classPathElement.getArtifactId()
+ + " to classpath");
path.add(classPathElement.getFile().toURL());
}
} catch (MalformedURLException e) {
@@ -557,7 +576,7 @@
/**
* Add any relevant project dependencies to the classpath. Takes
* includeProjectDependencies into consideration.
- *
+ *
* @param path classpath of {@link java.net.URL} objects
* @throws MojoExecutionException
*/
@@ -583,7 +602,9 @@
Iterator iter = dependencies.iterator();
while (iter.hasNext()) {
Artifact classPathElement = (Artifact)iter.next();
- getLog().debug("Adding project dependency artifact: " + classPathElement.getArtifactId() + " to classpath");
+ getLog().debug(
+ "Adding project dependency artifact: " + classPathElement.getArtifactId()
+ + " to classpath");
File file = classPathElement.getFile();
if (file != null) {
path.add(file.toURL());
@@ -605,9 +626,9 @@
for (Iterator artifacts = getAllDependencies().iterator(); artifacts.hasNext();) {
Artifact artifact = (Artifact)artifacts.next();
- //if (artifact.getScope().equals(Artifact.SCOPE_SYSTEM)) {
- systemScopeArtifacts.add(artifact);
- //}
+ // if (artifact.getScope().equals(Artifact.SCOPE_SYSTEM)) {
+ systemScopeArtifacts.add(artifact);
+ // }
}
return systemScopeArtifacts;
}
@@ -640,7 +661,8 @@
scope = Artifact.SCOPE_COMPILE;
}
- Artifact art = this.artifactFactory.createDependencyArtifact(groupId, artifactId, versionRange, type, classifier, scope, optional);
+ Artifact art = this.artifactFactory.createDependencyArtifact(groupId, artifactId, versionRange,
+ type, classifier, scope, optional);
if (scope.equalsIgnoreCase(Artifact.SCOPE_SYSTEM)) {
art.setFile(new File(dependency.getSystemPath()));
@@ -665,7 +687,7 @@
/**
* Determine all plugin dependencies relevant to the executable. Takes
* includePlugins, and the executableDependency into consideration.
- *
+ *
* @return a set of Artifact objects. (Empty set is returned if there are no
* relevant plugin dependencies.)
* @throws MojoExecutionException
@@ -691,17 +713,18 @@
/**
* Get the artifact which refers to the POM of the executable artifact.
- *
+ *
* @param executableArtifact this artifact refers to the actual assembly.
* @return an artifact which refers to the POM of the executable artifact.
*/
private Artifact getExecutablePomArtifact(Artifact executableArtifact) {
- return this.artifactFactory.createBuildArtifact(executableArtifact.getGroupId(), executableArtifact.getArtifactId(), executableArtifact.getVersion(), "pom");
+ return this.artifactFactory.createBuildArtifact(executableArtifact.getGroupId(), executableArtifact
+ .getArtifactId(), executableArtifact.getVersion(), "pom");
}
/**
* Examine the plugin dependencies to find the executable artifact.
- *
+ *
* @return an artifact which refers to the actual executable tool (not a
* POM)
* @throws MojoExecutionException
@@ -720,7 +743,10 @@
}
if (executableTool == null) {
- throw new MojoExecutionException("No dependency of the plugin matches the specified executableDependency." + " Specified executableToolAssembly is: " + executableDependency.toString());
+ throw new MojoExecutionException(
+ "No dependency of the plugin matches the specified executableDependency."
+ + " Specified executableToolAssembly is: "
+ + executableDependency.toString());
}
return executableTool;
@@ -730,25 +756,34 @@
Set executableDependencies;
try {
- MavenProject executableProject = this.projectBuilder.buildFromRepository(executablePomArtifact, this.remoteRepositories, this.localRepository);
+ MavenProject executableProject = this.projectBuilder.buildFromRepository(executablePomArtifact,
+ this.remoteRepositories,
+ this.localRepository);
// get all of the dependencies for the executable project
List dependencies = executableProject.getDependencies();
// make Artifacts of all the dependencies
- Set dependencyArtifacts = MavenMetadataSource.createArtifacts(this.artifactFactory, dependencies, null, null, null);
+ Set dependencyArtifacts = MavenMetadataSource.createArtifacts(this.artifactFactory, dependencies,
+ null, null, null);
// not forgetting the Artifact of the project itself
dependencyArtifacts.add(executableProject.getArtifact());
// resolve all dependencies transitively to obtain a comprehensive
// list of assemblies
- ArtifactResolutionResult result = artifactResolver.resolveTransitively(dependencyArtifacts, executablePomArtifact, Collections.EMPTY_MAP, this.localRepository, this.remoteRepositories,
- metadataSource, null, Collections.EMPTY_LIST);
+ ArtifactResolutionResult result = artifactResolver.resolveTransitively(dependencyArtifacts,
+ executablePomArtifact,
+ Collections.EMPTY_MAP,
+ this.localRepository,
+ this.remoteRepositories,
+ metadataSource, null,
+ Collections.EMPTY_LIST);
executableDependencies = result.getArtifacts();
} catch (Exception ex) {
- throw new MojoExecutionException("Encountered problems resolving dependencies of the executable " + "in preparation for its execution.", ex);
+ throw new MojoExecutionException("Encountered problems resolving dependencies of the executable "
+ + "in preparation for its execution.", ex);
}
return executableDependencies;
@@ -756,7 +791,7 @@
/**
* Stop program execution for nn millis.
- *
+ *
* @param millis the number of millis-seconds to wait for, <code>0</code>
* stops program forever.
*/