This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 5106129 Remove embedded goal in camel-maven-plugin. We use the run
goal always anyway.
5106129 is described below
commit 510612973ee1105ff4baec3519efa9bf551a2247
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun May 10 09:50:56 2020 +0200
Remove embedded goal in camel-maven-plugin. We use the run goal always
anyway.
---
.../modules/ROOT/pages/camel-3x-upgrade-guide.adoc | 4 +
.../ROOT/pages/camel-embedded-maven-goal.adoc | 14 --
.../modules/ROOT/pages/camel-maven-plugin.adoc | 7 -
.../modules/ROOT/pages/camel-run-maven-goal.adoc | 5 +-
.../java/org/apache/camel/maven/EmbeddedMojo.java | 196 ---------------------
5 files changed, 5 insertions(+), 221 deletions(-)
diff --git a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide.adoc
b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide.adoc
index 4f5ea97..1612727 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide.adoc
@@ -1165,6 +1165,10 @@ Camel K, Camel Quarkus, etc.
The following components is no longer supported in OSGi and has been removed
from the Camel Karaf features file:
camel-undertow, camel-jgroups, camel-jgroups-raft, camel-infinspan.
+=== camel-maven-plugin
+
+The `embedded` goal has been removed (was never really in use). Use `run` goal
instead.
+
=== API changes
The dump model classes in package `org.apache.camel.support.dump` has been
removed
diff --git a/docs/user-manual/modules/ROOT/pages/camel-embedded-maven-goal.adoc
b/docs/user-manual/modules/ROOT/pages/camel-embedded-maven-goal.adoc
deleted file mode 100644
index d1eb44f..0000000
--- a/docs/user-manual/modules/ROOT/pages/camel-embedded-maven-goal.adoc
+++ /dev/null
@@ -1,14 +0,0 @@
-= camel:embedded
-
-The *camel:embedded* goal of the xref:camel-maven-plugin.adoc[Camel
-Maven Plugin] is used to run your Camel xref:spring.adoc[Spring]
-configurations in the same JVM as Maven, so it should startup a bit
-faster than xref:camel-run-maven-goal.adoc[camel:run]. Though sometimes
-we all get the odd classpath issue; so sometimes forking a new JVM can
-work around any strange Maven classpath issues.
-
-[source,xml]
-----
-cd examples/camel-example-spring
-mvn camel:embedded
-----
diff --git a/docs/user-manual/modules/ROOT/pages/camel-maven-plugin.adoc
b/docs/user-manual/modules/ROOT/pages/camel-maven-plugin.adoc
index 4ef4974..0678cb1 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-maven-plugin.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-maven-plugin.adoc
@@ -19,13 +19,6 @@ runs your routing rules. From Camel 2.10 onwards also OSGi
blueprint is
supported to load from *OSGI-INF/blueprint/*.xml* (requires to configure
the plugin to use blueprint).
-|xref:camel-embedded-maven-goal.adoc[camel:embedded] |camel:embedded
-|Boots up Camel using the xref:spring.adoc[Spring] configuration at
-*META-INF/spring/*.xml* and runs your routing rules. From Camel 2.10
-onwards also OSGi blueprint is supported to load from
-*OSGI-INF/blueprint/*.xml* (requires to configure the plugin to use
-blueprint).
-
|=======================================================================
== Adding the plugin to your pom.xml
diff --git a/docs/user-manual/modules/ROOT/pages/camel-run-maven-goal.adoc
b/docs/user-manual/modules/ROOT/pages/camel-run-maven-goal.adoc
index 40e4845..d6a6062 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-run-maven-goal.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-run-maven-goal.adoc
@@ -17,16 +17,13 @@ independently.
How this works is that the plugin will compile the source code in the
maven project, then boot up a Spring ApplicationContext using the XML
-confiuration files on the classpath at
+configuration files on the classpath at
[source,syntaxhighlighter-pre]
----
META-INF/spring/*.xml
----
-If you want to boot up your Camel routes a little faster, you could try
-the xref:camel-embedded-maven-goal.adoc[camel:embedded] instead.
-
== Running OSGi Blueprint
From *Camel 2.10* onwards the `camel:run` plugin also supports running a
diff --git
a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
deleted file mode 100644
index 748209e..0000000
---
a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * 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.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.maven;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-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.List;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-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>
- * and starting up the context; then generating
- * the DOT file before closing the context down.
- */
-@Mojo(name = "embedded", defaultPhase = LifecyclePhase.PREPARE_PACKAGE,
requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
-public class EmbeddedMojo extends AbstractExecMojo {
-
- /**
- * The duration to run the application for which by default is in
milliseconds.
- * A value <= 0 will run forever.
- * Adding a s indicates seconds - eg "5s" means 5 seconds.
- */
- @Parameter(property = "camel.duration", defaultValue = "-1")
- protected String duration;
-
- /**
- * The classpath based application context uri that spring wants to get.
- */
- @Parameter(property = "camel.applicationContextUri")
- protected String applicationContextUri;
-
- /**
- * The filesystem based application context uri that spring wants to get.
- */
- @Parameter(property = "camel.fileApplicationContextUri")
- protected String fileApplicationContextUri;
-
- /**
- * Project classpath.
- */
- @Parameter(property = "project.testClasspathElements", required = true,
readonly = true)
- private List<?> classpathElements;
-
- /**
- * The main class to execute.
- */
- @Parameter(property = "camel.mainClass", defaultValue =
"org.apache.camel.spring.Main", required = true)
- private String mainClass;
-
- /**
- * This method will run the mojo
- */
- @Override
- public void execute() throws MojoExecutionException {
- try {
- executeWithoutWrapping();
- } catch (Exception e) {
- throw new MojoExecutionException("Failed: " + e, e);
- }
- }
-
- 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 {
- Thread.currentThread().setContextClassLoader(oldClassLoader);
- }
- }
-
- // Properties
- //-------------------------------------------------------------------------
-
- public List<?> getClasspathElements() {
- return classpathElements;
- }
-
- public void setClasspathElements(List<?> classpathElements) {
- this.classpathElements = classpathElements;
- }
-
- public String getDuration() {
- return duration;
- }
-
- public void setDuration(String duration) {
- this.duration = duration;
- }
-
- public String getApplicationContextUri() {
- return applicationContextUri;
- }
-
- public void setApplicationContextUri(String applicationContextUri) {
- this.applicationContextUri = applicationContextUri;
- }
-
- public String getFileApplicationContextUri() {
- return fileApplicationContextUri;
- }
-
- public void setFileApplicationContextUri(String fileApplicationContextUri)
{
- this.fileApplicationContextUri = fileApplicationContextUri;
- }
-
- public String getMainClass() {
- return mainClass;
- }
-
- public void setMainClass(String mainClass) {
- this.mainClass = mainClass;
- }
-
- // Implementation methods
- //-------------------------------------------------------------------------
-
- protected void runCamel(ClassLoader newLoader) throws
ClassNotFoundException, NoSuchMethodException,
- IllegalAccessException, MojoExecutionException {
-
- getLog().debug("Running Camel in: " + newLoader);
- Class<?> type = newLoader.loadClass(mainClass);
- Method method = type.getMethod("main", String[].class);
- String[] arguments = createArguments();
- getLog().debug("Starting the Camel Main with arguments: " +
Arrays.asList(arguments));
-
- try {
- method.invoke(null, new Object[] {arguments});
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- throw new MojoExecutionException("Failed: " + t, t);
- }
- }
-
- protected String[] createArguments() {
-
- List<String> args = new ArrayList<>(5);
-
- if (applicationContextUri != null) {
- args.add("-applicationContext");
- args.add(applicationContextUri);
- } else if (fileApplicationContextUri != null) {
- args.add("-fileApplicationContext");
- args.add(fileApplicationContextUri);
- }
-
- args.add("-duration");
- args.add(getDuration());
-
- return args.toArray(new String[0]);
- }
-
- public ClassLoader createClassLoader(ClassLoader parent) throws
MalformedURLException {
- getLog().debug("Using classpath: " + classpathElements);
-
- int size = classpathElements.size();
- URL[] urls = new URL[size];
- for (int i = 0; i < size; i++) {
- String name = (String) classpathElements.get(i);
- File file = new File(name);
- urls[i] = file.toURI().toURL();
- getLog().debug("URL: " + urls[i]);
- }
- URLClassLoader loader = new URLClassLoader(urls, parent);
- return loader;
- }
-}