How to use wro4j programmatically?

Skip to first unread message

Apr 5, 2017, 4:01:13 AM4/5/17
to wro4j

We plan on adding asset bundling and minification capabilities to the LearnITy Framework ( For this we are exploring the use of wro4j. Since the framework uses its own Java based build mechanism to generate markup (HTML) we need to implement the asset bundling and minification from within this Java code. Hence, the Maven plugin is not very useful for us.

Can you give us a guideline as to how we can make use of wro4j programmatically? For example we would like to give the list of input files and the list of processors and produce the bundled and minified file as output.


Diptendu Dutta

Alex Objelean

Apr 5, 2017, 4:29:09 AM4/5/17
to wro4j

the wro4j library responsibility is to create bundles of css/js resources, it does not generate markup (HTML). 
There are two ways of generating resources: build-time (maven or other build tools) or runtime (filter/servlet). 
Though it is possible to use it programmatically (you can look at how the maven plugin is implemented -  see resources below), it is not that straightforward. 
It might be a good feature to evolve the library to become more API friendly and I would like to consider in the future (depending on my spare time though... ) 

A few useful resources:
1) Maven plugin implementation (which is a way to programmatically use wro4j)

Let me know if that helps,
Reply all
Reply to author
0 new messages