Belgacem
Belgacem

Reputation: 193

How to Deploy an artifact programmatically using Maven

I have a mission to develop an integration tool which allows from a source code folder to generate a WAR or OSGI Bundle and then deploys it in Tomcat or Karaf. I used Maven Embedder to create the artifacts, now my problem is how to configure my pom.xml to automatically deploy these artifacts.

on the internet I can't find any examples and also I'm new to the world of JEE and Maven. please help me.

Upvotes: 0

Views: 239

Answers (1)

Smutje
Smutje

Reputation: 18173

  1. Find out how you can deploy artifacts to Tomcat or Karaf (without Maven).
  2. Find out how you can deploy artifacts to Tomcat or Karaf programmatically.
  3. Find a Maven plugin to use that deployment method.

The simplest solution would be to use something like the maven-resources-plugin to copy your built artifacts to the servers deployment directory but I am pretty sure that there are more sophisticated methods like http://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/deploy-only-mojo.html for deploying out of maven without plain file system mechanisms.

On a wider scale when working on problems like yours it always helps to take a step back and think about the abstract use case ("How to deploy something somewhere" followed by "How to deploy something somewhere programmatically") before going into detail and think about Tomcat or other application servers - and in most cases you will find out that there were hundreds of other who already had the same problem and solved it some way or the other.

Upvotes: 2

Related Questions