m2e-wro4j icon indicating copy to clipboard operation
m2e-wro4j copied to clipboard

Doesn't support war overlays

Open denu opened this issue 12 years ago • 4 comments

Hello,

I've got maven project with 17 overlayed war dependencies. I've added wro4j plugin to main project, also wro.xml is in there, and no matter if I use static path or classpath...

Neither of this works: /core/js/.js classpath:__.js classpath:/core/js/.js

As a workaround I have to use this (but there comes SVN issue, as each developer in team uses different dirs for sources): file:d:\stsworkspace\xariswebcore\src\main\webapp\core\js**.js

denu avatar Jun 28 '12 18:06 denu

Can you setup a test project (on github) reproducing the issue?

Please note that m2e-wro4j won't process resources from other projects than the one having the maven-wro4j-plugin config. So if you have a projet p1 having an overlay dependency on p2, and want minified p2 .js files deployed in p1, you'll need to explicitely use maven-wro4j-plugin on p2

fbricon avatar Jun 28 '12 19:06 fbricon

Thanks for replying.

I thought that is possible, as a matter of order in which are maven plugins launched. Eg. use m2e-wro4j to fire wro4j plugin at the end of the build process, after the maven war plugin is finished.

So war ovelay do this: main: proj1/src/webapp/js/foo.js + overlay: proj2/src/webapp/js/bar.js

gives:

proj1/src/webapp/js/foo.js proj1/src/webapp/js/bar.js

and then fire wro4j with path: /**.js and expect:

proj1/src/webapp/js/all.js (which includes minified foo.js and bar.js)

I think I presented it clearer now, but i can later provide test-case project.

greetz!

denu avatar Jun 29 '12 05:06 denu

The maven war plugin is not invoked in Eclipse, since m2e-wtp delegates all the packaging / deployment to WTP. The actual build lifecycle is different :

  • user modifies a resource
  • eclipse (incremental) builders kick in
  • the eclipse maven (m2e) builder calls m2e-wro which in turn invokes maven-wro4j-plugin:run on the modified project
  • if the project is deployed on a WTP server, the gen'd resources are automatically published.
  • during deployment, if overlay dependencies changed, they're redeployed

So, given the current m2e-wtp / m2e-wro4j implementations, there's no way to produce what you expect. I'm not saying it's impossible, but really don't see a solution right now.

There might be a hack involving maven profiles and resource filtering to workaround the absolute path problems in your current solution, but again I'd need a sample project to try. And I'm not sure it'd work anyway.

fbricon avatar Jun 29 '12 06:06 fbricon

Hello there,

As you said I've created test-case project and commited it over github to make it easier to work it out. Hope you will find a way!

https://github.com/denu/denu/tree/master/parent

greetz

denu avatar Jul 16 '12 17:07 denu