How To: Maven project to build JavaScript in Eclipse -


how configure pom have folder act javascript build path?

i have developers import project eclipse , automatically have javascript root folder in eclipse build path auto-complete , other javascript support works.

here do, , seems work okay. i'm using eclipse juno sr2 (java ee web developers), , maven 3.0.5, right now. (i'm not expert in either eclipse or maven, i'm sure there more elegant way of doing this. please let me know!)

we want have project structure below, per maven conventions:

- src  +-- main    +-- java    +-- js    +-- webapp      +--  web-inf  +-- test    +-- java    +-- js 

and want have web application deployed structure like:

- /  +-- js  +-- web-inf    +-- classes 

the key portion of maven pom.xml in maven-war-plugin, copies on src/main/js files:

        <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-war-plugin</artifactid>             <version>2.3</version>             <configuration>                 <archiveclasses>true</archiveclasses>                 <webresources>                     <!-- in order interpolate version pom appengine-web.xml -->                     <resource>                         <directory>${basedir}/src/main/webapp/web-inf</directory>                         <filtering>true</filtering>                         <targetpath>web-inf</targetpath>                     </resource>                     <resource>                         <directory>${basedir}/src/main/js</directory>                         <filtering>true</filtering>                         <targetpath>js</targetpath>                     </resource>                                         </webresources>             </configuration>         </plugin> 

(i'm using google app engine projects right now, appengine-maven-plugin copies in java code , other resources.) this, should able use maven build project. there other maven javascript plugins available, testing , dependencies, etc, think basic functionality.

on eclipse side, couple of things:

  • be sure use have javascript project facet activated.
  • under project properties -> javascript -> include path -> source tab, click "add folder" , select "src/main/js". can remove whatever default path is.
  • under project properties -> deployment assembly, add /src/main/js folder, , set deploy path appropriately (from structure above, want javascript go "/js".

i can manage java dependencies , deploy appengine maven, or code , debug eclipse (after fiddling around), , seems work. integrate front-end js tests maven (maybe using javascript-maven-plugin), task day.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -