Nav

Maven Publishing Plugin

If you create a Maven project, you can use the Galaxy Publishing plugin for Maven to easily publish your project and/or its resources to a Tcat Server repository. To use the plugin, you add the necessary Maven repositories to your Maven POM, and then configure the plugin using the <configuration> tags in your POM. The rest of this page describes these tasks.

After using the plugin to update your applications, you can schedule a script to listen for these updates and automatically redeploy their packages. For an example, see Automatically Redeploying After an Artifact Update.

Adding the Tcat Server Repository to the POM

The first step is to add your Tcat Server repository (or snapshot repository) to your Maven POM. The Tcat Server repository includes he Mule Dependencies repository, and the Apache Incubating repository.

Add these to the <pluginRepositories> section so that Maven knows where to get the required files:


         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<pluginRepositories>
    <pluginRepository>
      <id>mule.dependencies</id>
      <url>http://dist.codehaus.org/mule/dependencies/maven2/</url>
      <name>Mule Dependencies Repository</name>
    </pluginRepository >
 
    <!-- For the Abdera dependencies -->
    <pluginRepository>
      <id>apache-incubating</id>
      <name>Apache Incubating Repository</name>
      <url>http://people.apache.org/repo/m2-incubating-repository/</url>
    </pluginRepository>
</pluginRepositories>

Configuring the Plug-in

After adding the Maven repositories to the POM, you configure the plug-in as shown in the following example configuration, which publishes the generated WAR from Maven to your Tcat repository:


         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<build>
  <plugins>
     <plugin>
        <groupId>org.mule.galaxy</groupId>
        <artifactId>galaxy-maven-publish-plugin</artifactId>
        <version>2.0.0</version>
        <configuration>
          <url>http://localhost:8080/console/api/registry/Applications</url>
          <username>admin</username>
          <password>admin</password>
          <overwrite>true</overwrite>
 
          <!-- Publish generated WAR -->
          <includes>
            <include>target/*-${version}.war</include>
          </includes>
        </configuration>
        <executions>
          <execution>
            <id>publish-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>execute</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
...

Configuring Security Information

If you do not want to include the user name and password in your POM, you can put it in your ~/.m2/settings.xml file. This file looks like:


         
      
1
2
3
4
5
6
7
8
9
<settings>
  <servers>
    <server>
      <id>myServer</id>
      <username>admin</username>
      <password>admin</password>
    </server>
  </servers>
</settings>

To use this security information, add the following tag to your plugin configuration, replacing myServer with the same ID you used in the settings.xml file above:


         
      
1
2
3
4
5
<configuration>
  ...
  <serverId>myServer</serverId>
  ...
</configuration>