Wednesday, February 16, 2011

Mavenizing Red5: Antrun Plugin saves a lot of time

Red5Load will have an obvious dependency on Red5 libraries. Fortunately, building from source packages exactly what I need in a convenient archive (red5.jar). Unfortunately, I chose to layout Red5Load as a Maven 2 project. The Red5 team stubbornly insists on distributing their source as an Ant project with Ivy for dependency management. Don't get me wrong, I've nothing against Ant. I've just been working with Maven for so long that the Ant way of doing things is almost alien to me.

If that's not enough, previous experience indicates I'll eventually hit a wall delegating to or extending Red5 classes and will have to resort to modifying the source. If I chose to fully mavenize the project, I'll drive myself crazy trying to keep the Red5 drop tracking well with the vendor source. What I need is a way to kick off the drop's Ant build and collect the resulting jar(s) as resolvable Maven artifacts.

Enter maven-antrun-plugin
. This convenient little tool allows me to bind appropriate Ant targets to phases in a Maven build's lifecycle. I've chosen to handle, obviously, clean, compile and package.




maven-antrun-plugin
1.6







Each execution targets the same goal, antrun:run.


...

run

...


Cleaning is fairly trivial, requiring only executing ant against the target clean.


antrun.clean
clean





...


To compile, we simply call ant
with no specified target. The Red5 project defines a build.xml configuration that Ant automatically picks up, but we could easily provide our own and specify an antfile
attribute to the ant tag.


antrun.compile
compile





...


Packaging is a little more interesting. Since Maven isn't actually handling archiving, we have to coax Maven into injecting the resulting jar (or jars) from the Ant build under resolvable coordinates. This is where the attachartifact tag proves extremely useful.



antrun.package
package






...


You can read up on classifiers here, but for now the important thing to take away is that our complete POM will configure three artifacts in our local repository:

  1. red5-1.0.0-SNAPSHOT.pom
  2. red5-1.0.0-SNAPSHOT-server.jar
  3. red5-1.0.0-SNAPSHOT-boot.jar

2 comments:

  1. Remember that one spin will typically be done within a few of} seconds. Here are the principle issues we thought-about when looking down the top free spin promos. If you want more info, certain to|make sure to|remember to} check out at|try} our information on the most effective on line casino bonuses. Compared to most free spins casinos, this supply stands 돈포차 out as distinctive end result of|as a end result of} you need to|you should|you have to} make three deposits to receive the entire 150 free spins. Lucky Tiger's bonus is a decent supply compared to with} different on line casino free spins bonuses we tried out.

    ReplyDelete
  2. Each one meets our strict standards when it comes to of|in relation to} the quality of its video games, bonuses, and popularity. The betting opportunities at on-line roulette sites are so broad that you simply might get dizzy from the abundance. There are many ways to score a win, but which one should you to|must you} really choose? You’ve all heard of inserting a guess on a selected number, 1xbet but actually, there are additionally different methods to wager. In the following desk, we’ll give you data relating to a few of the the} most typical bets available on the roulette desk. Some on-line roulette video games have minimum Straight Up stakes worth $0.10, but $0.50-$1.00 is extra widespread.

    ReplyDelete