maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manos Batsis <>
Subject Re: Maven build for compiling JavaScript project
Date Wed, 25 Aug 2010 18:41:03 GMT
On 08/25/2010 06:05 PM, Jacob Beard wrote:
> I'm working on a Commons sandbox component which is written mostly in
> JavaScript. I currently have an ant build which includes tasks to do the
> following:
> 1. combine all of the JavaScript modules into a single file
> 2. minify the combined JavaScript file using the Google Closure
> JavaScript compiler
> 3. compile the combined JavaScript file to a single Java class file
> using the Rhino jsc compiler
> 4. create an executable JAR containing the class file.
> I'm interested in working toward releasing the project, and so I'm
> trying to determine what would be the most elegant way to now build this
> project with Maven. Based on my understanding of the tasks performed by
> Maven when staging a release, it seems to me that the compiler task
> would need to be made to delegate to tasks 1-3 of the project's Ant
> script. After the class file has been created with jsc, I believe the
> Maven jar and assembly tasks should work as though the project were a
> regular Java project.
> If my understanding so far is correct, I'm wondering what is the best
> way to override or customize the behaviour of Maven's compiler task so
> that it delegates to Ant (probably via the antrun Maven plugin)?

The way I get this, you don't have to change the behavior of Maven's 
compiler plugin.

If you check out [1], you'll see there are plenty of lifecycle phases to 
hook your ant tasks (or whatnot) and perform steps 1, 2 and 3.

For example, I'd probably use generate-(re)sources/process-(re)sources 
to perform 1 and 2.

For step 3, generate-sources is greate for code generation (i.e. if that 
jsc thingy produces .java code), otherwise I'd just throw in the 
generated class files in the target during prepare-package or, 
especially if you need tests, process-classes.

Step 4 will be taken care of by maven automatically using the default 
jar packaging.

Perhaps you would be interested in helping us implement 1-3 in the 
maven-jstools-plugin [2] ;-)





To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message