Hi Christopher,

Thank you for your kind help. Please see inline below...

On 01/07/2012 04:14 AM, Christopher Hunt wrote:
On 07/01/2012, at 6:28 AM, Farrukh Najmi wrote:


I am trying to use javascript-maven-plugin. It seems cool though the documentation seems to be fairly minimal.
Really? Are you looking at http://mojo.codehaus.org/javascript-maven-tools/ ?

I did see all the docs at above site. I am an experienced developer but I still cannot figure out how I can have a js module be consumed by a separate war module based on available docs. Thus I am thinking that the docs could potentially be improved in this regard.


Also, the project produced by the JS RIA archetype should help in terms of documentation (1).

I did generate a project using the archtype and it did not help in explaining how to consume the generated project in a separate war project as a dependency. I am currently using the maven-dependency-plugin in my war project like this:

<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-js-deps</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeTypes>js</includeTypes>
<outputDirectory>${basedir}/target/classes/js</outputDirectory>
</configuration>
</execution>

</executions>
</plugin>

Is this the best way?

Also, I have js script files referenced in FreeMarker templates in the war project like this:

<html>
<head>
<script src="../../../../../../../js/jquery-amd-${jquery.version}.js"></script>
</head>
<body>
        ...
</body>
</html>

This requires that I use maven-resource-plugin using snippet below to filter the FreeMarker templates in my project to fix the versions for the js file dependencies. Is there a better way?

<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>

Again this could be a topic to address in the docs.

Can someone please tell me:

    * How do I consume a module of <type>js</type> produced by
      javascript-maven-plugin in a module of <type>war</type>

The trick here is to use the assembly plugin. You need to have a <type>js</type> module and then have an assembly.xml that produces a war artifact.

    * Which modules need the javascript-maven-plugin build extension.
      Is it just the js module or also the war module?

You can have a separate war module if you want. However using an assembly requires just the one module to produce the js.

I definitely have a need for separate war module because that is how my large project is structured and I do not want to change that.

    * Is there any other resource on using the
      javascript-maven-plugin in a large multi-module project

The javascript-maven-tools project has a number of js modules itself (2) and is a reasonable example. I've personally used javascript-maven-plugin in a multi module js/war/ear project. It should look and behave no differently to any other Maven module.


I guess what I was thinking was that I would simply add the js project as a dependency of my war project and maven build would take care of copying the .js file for my project and its dependencies to the correct places in the war without my doing anything. Is this the correct expectation?

A little more explicit help on how to consume a js project in a separate war project would be very helpful still if you could spare the time. And I think including such info in the http://mojo.codehaus.org/javascript-maven-tools/index.html page would be a terrific.


    * Any ETA for when javascript-maven-plugin 2.0.0 will be released

I've pushed for the two remaining snapshot project dependencies it has (js import and web minifier) to go 1.0. Looks as though the voting is going well and I should be able to release them next week.

The only thing then is what to do about m2e integration. We've been working on a high degree of compatibility with m2e but, quite honestly, we're finding this a challenge. We might abandon the m2e integration for the release of 2.0.0 as it is becoming a stopper for us.

+1 for deferring m2e integration. There are many folks who have no need for m2e. The project would get more usage and generate more feedback with a release 2.0.0.
Best wishes for the release and warm appreciation for this good work.

Thanks for your help.
Thanks for your interest! Please let me know if there is anything else we can do for you.

Kind regards,
Christopher

(1) http://mojo.codehaus.org/javascript-maven-tools/javascript-ria-archetype/index.html (2) http://mojo.codehaus.org/javascript-maven-tools/javascript-libraries/index.html


--
Regards,
Farrukh Najmi

Web: http://www.wellfleetsoftware.com


Reply via email to