diff --git a/assembly/pom.xml b/assembly/pom.xml index b28c7597ec..7114e4e442 100755 --- a/assembly/pom.xml +++ b/assembly/pom.xml @@ -302,7 +302,16 @@ + + - + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6cc1b60ecc..78e4915c51 100755 --- a/pom.xml +++ b/pom.xml @@ -145,8 +145,8 @@ - scm:svn:http://svn.apache.org/repos/asf/incubator/activemq/trunk - scm:svn:http://svn.apache.org/repos/asf/incubator/activemq/trunk + scm:svn:https://svn.apache.org/repos/asf/incubator/activemq/trunk + scm:svn:https://svn.apache.org/repos/asf/incubator/activemq/trunk http://svn.apache.org/viewcvs.cgi/incubator/activemq/trunk/ @@ -907,4 +907,4 @@ 1.1.3.4d_b4_min 1.1.2 - + \ No newline at end of file diff --git a/tooling/maven-activemq-memtest-plugin/pom.xml b/tooling/maven-activemq-memtest-plugin/pom.xml index d3b9add0e6..87e47c160b 100644 --- a/tooling/maven-activemq-memtest-plugin/pom.xml +++ b/tooling/maven-activemq-memtest-plugin/pom.xml @@ -6,7 +6,7 @@ incubator-activemq activemq-parent - 4.0-SNAPSHOT + 4.1-SNAPSHOT ../../pom.xml @@ -25,42 +25,34 @@ incubator-activemq activemq-core - 4.0-SNAPSHOT incubator-activemq activemq-console - 4.0-SNAPSHOT incubator-activemq activeio-core - 3.0-beta2 org.apache.derby derby - 10.1.1.0 org.apache.derby derbynet - 10.1.1.0 backport-util-concurrent backport-util-concurrent - 2.1 org.apache.geronimo.specs geronimo-jms_1.1_spec - 1.0 org.apache.geronimo.specs geronimo-j2ee-management_1.0_spec - 1.0 \ No newline at end of file diff --git a/tooling/maven-activemq-plugin/pom.xml b/tooling/maven-activemq-plugin/pom.xml new file mode 100644 index 0000000000..1e00f6e0f5 --- /dev/null +++ b/tooling/maven-activemq-plugin/pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + + + incubator-activemq + activemq-parent + 4.1-SNAPSHOT + ../../pom.xml + + + + incubator-activemq + maven-activemq-plugin + maven-plugin + ActiveMQ :: StartUp Plugin + + + + org.apache.maven + maven-plugin-api + 2.0 + + + incubator-activemq + activemq-core + + + incubator-activemq + activemq-console + + + incubator-activemq + activeio-core + + + org.apache.derby + derby + + + org.apache.derby + derbynet + + + backport-util-concurrent + backport-util-concurrent + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + org.apache.geronimo.specs + geronimo-j2ee-management_1.0_spec + + + diff --git a/tooling/maven-activemq-plugin/src/main/java/org/apache/activemq/maven/BrokerMojo.java b/tooling/maven-activemq-plugin/src/main/java/org/apache/activemq/maven/BrokerMojo.java new file mode 100644 index 0000000000..80ddf15230 --- /dev/null +++ b/tooling/maven-activemq-plugin/src/main/java/org/apache/activemq/maven/BrokerMojo.java @@ -0,0 +1,116 @@ +package org.apache.activemq.maven; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed 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. + */ + +import org.apache.activemq.console.Main; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.MappedByteBuffer; +import java.nio.channels.FileChannel; + +/** + * Goal which starts activemq broker. + * + * @goal run + * @phase process-sources + */ +public class BrokerMojo + extends AbstractMojo { + /** + * Location of the output directory. Defaults to target. + * + * @parameter expression="${project.build.directory}" + * @required + */ + private File outputDirectory; + + /** + * Location of activemq xml config file. + * + * @parameter expression="${configFile}" + */ + private File configFile; + + /** + * Broker URL. + * + * @parameter expression="${url}" default-value="broker:(tcp://localhost:61616)?useJmx=false" + */ + private String url; + + public void execute() + throws MojoExecutionException { + + File out = outputDirectory; + + // Create output directory if it doesn't exist. + if (!out.exists()) { + out.mkdirs(); + } + + String[] args = new String[2]; + if (configFile != null) { + File config; + try { + config = copy(configFile); + } catch (IOException e) { + throw new MojoExecutionException(e.getMessage()); + } + + args[0] = "start"; + args[1] = "xbean:" + (config.toURI()).toString(); + } else { + args[0] = "start"; + args[1] = url; + } + + Main.main(args); + } + + /** + * Copy activemq configuration file to output directory. + * + * @param source + * @return + * @throws java.io.IOException + */ + public File copy(File source) throws IOException { + FileChannel in = null, out = null; + File dest = new File(outputDirectory.getAbsolutePath() + File.separator + source.getName()); + + try { + in = new FileInputStream(source).getChannel(); + out = new FileOutputStream(dest).getChannel(); + + long size = in.size(); + MappedByteBuffer buf = in.map(FileChannel.MapMode.READ_ONLY, 0, size); + + out.write(buf); + + } finally { + if (in != null) in.close(); + if (out != null) out.close(); + } + + return dest; + } +} \ No newline at end of file