On 06/15/2010 01:23 AM, Haszlakiewicz, Eric wrote:

I've got a webapp that uses javascript files from third party projects.
For instance, one of the files we use is prototype.js.  It seems like
this must be something that many people have done in the past, but I
can't seem to find much information about it.

The first issue I have is that I can't seem to find a maven repository
that has this file (or any of the other javascript scripts I use).  Is
there one?

Since I couldn't find one, I uploaded a copy to my local repository
(Nexus) using:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd";
xmlns="http://maven.apache.org/POM/4.0.0";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
        <modelVersion>4.0.0</modelVersion>
        <groupId>org.prototypejs</groupId>
        <artifactId>prototype</artifactId>
        <version>1.6.1</version>
        <packaging>js</packaging>
        <url>http://prototypejs.org/assets/2009/8/31/prototype.js</url>
</project>

and I then added an entry to the pom for my webapp:
         <dependency>
             <groupId>org.prototypejs</groupId>
             <artifactId>prototype</artifactId>
             <type>js</type>
             <version>1.6.1</version>
         </dependency>


but I can't figure out how to get this to actually get included into the
war file.  I tried configuring an overlay, but it doesn't seem to do
anything:
     <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-war-plugin</artifactId>
         <configuration>
           <overlays>
             <overlay>
               <groupId>org.prototypejs</groupId>
               <artifactId>prototype</artifactId>
               <type>js</type>
               <targetPath>common/javascript</targetPath>
             </overlay>
           </overlays>
         </configuration>
        </plugin>

All I see is a warning when I run "mvn package":
[WARNING] Skip unpacking dependency
file[/u/ehaszla/.m2/repository/org/prototypejs/prototype/1.6.1/prototype
-1.6.1.js with unknown extension[js]

I want to end up with a file called "prototype-1.6.1.js" in the
"common/javascript" directory within the war file.

How do I get this to work?


There is no standard convention yet AFAIK. Including the JS libs in the war is one thing, making it accessible to the browser through a specific URL is another.

Here (at Abiss.gr) we use the JStools plugin [1]; we include JS libs using JARs as everything else and a filter [2] to serve scripts to the client. I think the maven-javascript-plugin [3] has something else.

Searching the archives should give more info, although both projects have pretty good documentation. Overall however, JS libs in repos have not cought on - you will have to include libs in your own repo for most stuff.

[1] http://dev.abiss.gr/mvn-jstools/
[2] http://dev.abiss.gr/mvn-jstools/js-packaging.html
[3] http://mojo.codehaus.org/javascript-maven-tools/

hth,

Manos

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to