Index: src/main/java/org/apache/activemq/maven/BrokerMojo.java =================================================================== --- src/main/java/org/apache/activemq/maven/BrokerMojo.java (revision 784679) +++ src/main/java/org/apache/activemq/maven/BrokerMojo.java (working copy) @@ -32,7 +32,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +import java.io.File; import java.util.Properties; import org.apache.activemq.broker.BrokerFactory; @@ -69,6 +69,15 @@ private String configUri; /** + * A reference to a configuration file. + * + * @parameter expression="${configFile}" + * default-value=null + * @required + * + */ + private String configFile; + /** * Indicates whether to fork the broker, useful for integration tests. * * @parameter expression="${fork}" default-value="false" @@ -85,9 +94,11 @@ public void execute() throws MojoExecutionException { try { setSystemProperties(); - getLog().info("Loading broker configUri: " + configUri); - final BrokerService broker = BrokerFactory.createBroker(configUri); + String config = getBrokerConfiguration(); + getLog().info("Loading broker configUri: " + config); + + final BrokerService broker = BrokerFactory.createBroker(config); if (fork) { new Thread(new Runnable() { public void run() { @@ -141,6 +152,20 @@ } /** + * Return a valid configuration String for the broker. + * + * @return the configuration URI for the broker. + */ + protected String getBrokerConfiguration() { + if (configFile != null) { + File conf = new File(configFile); + return "xbean:" + conf.toURI(); + } else { + return configUri; + } + } + + /** * Set system properties */ protected void setSystemProperties() {