Skip to main content

What is a better, simpler and more modern way to build Java Web Applications compared to Maven?


I'm thinking of getting rid of Maven. It's alright for simple applications, but I'm running into problems that I can't solve, nobody else seems to be able to solve them, and even the Maven mailing list doesn't have a solution.



What are some modern build tools for Java that provide what Maven provides, but also are equipped to deal with the challenges of making modern web applications? For example, if I want to use a Javascript minification tool, such as the YUI compressor, it will easily and effortlessly let me compress/aggregate my css and javascript just before the War file is created.





  • Explanation : The problem with maven is that there is no way to do things inside of the war plugin. For example, I want to call the yui compressor just after it copies over the webapp's resources (css, images, javascripts, etc.). If I could do this, it would ensure that any uncompressed javascript files (that were excluded in the YUI compressor's minification/aggregation process) were part of the final war package. This is not possible



    The YUI compressor only works if you plan on compressing and/or aggregating all your files as opposed to a subset. There are javascript files like jscharts.js where you need to exclude them from the minification process because they otherwise mess up the actual source code. There is no way to deal with this use-case in Maven, even though the solution is simple.





Having the ability to use live javascript vs. compressed/aggregated javascript would also be a big boon.





  • Explanation : It's also hard to refactor your massive javascript includes with those in your html files. Let's say you have 100 javascript files, and you want the ability to use your live javascript files for development, but you want to use the compressed/aggregated ones for production. You still need to include all the javascript files in your html templates (freemarker for example) because you want to deal with the live ones during development. For production, you also have to maintain a separate list in the maven pom.xml as well, in order to aggregate them.



    Both of these lists of javascript files are basically identical, and it's an extra burden for the developer to ensure they include the same files and in the same order :( Maven isn't helping with such a common web-related problem for year 2011. The Rails 3.1 folks though get this for free. We can do better.





I still need the ability to have filters, just like in maven, to handle different production environments. For example, I often use property files to change values in the applicationContext.xml for Spring, or the servlet context.



I also need the ability to add resources to the classpath. I have these massive text files that provide me with the basic functionality of a dictionary, thesaurus, etc. I need to put these in my classpath.



It would be great if the build tool also used the Maven repositories.



Any other benefits, such as more simplicity and writing less configuration code would be a plus, but the features I listed above are paramount.



Thank you.


Source: Tips4allCCNA FINAL EXAM

Comments

  1. You ought to be able to do all of that in Gradle. Essentially, its a set of libraries and modules in Groovy that give you a lot of power for putting together your build. If you need to extend it, then you write your extension in Groovy. Its quite nice.

    ReplyDelete
  2. If you are into learning Scala then I highly recommend SBT. We use it to build all our Java code and have been perfectly happy with it. It does neat things such as parallel builds and unlike ANT/Maven its incremental compilation actually seams to work. Also it includes a nice REPL that allows you to interact directly with the build and your code.

    SBT is easy to extend as it's build files are written in code rather than XML. So plugins exists for everything your heart can desire, for example:


    YUI compressor
    CoffeeScript


    As for project dependencies, these can be both managed (downloaded automatically from Maven/Ivy) or unmanaged (i.e. resources (jar's, files, ...) you add yourself) - they can also be mixet and matched.

    SBT uses the standard Maven directory layout (although this can easily be changed), has great support for IDE's (fx. Eclipse and Idea) and it can also produce a pom file for you if you should so desire.

    There is a very good guide to get you started quickly with SBT here

    ReplyDelete

Post a Comment

Popular posts from this blog

[韓日関係] 首相含む大幅な内閣改造の可能性…早ければ来月10日ごろ=韓国

div not scrolling properly with slimScroll plugin

I am using the slimScroll plugin for jQuery by Piotr Rochala Which is a great plugin for nice scrollbars on most browsers but I am stuck because I am using it for a chat box and whenever the user appends new text to the boxit does scroll using the .scrollTop() method however the plugin's scrollbar doesnt scroll with it and when the user wants to look though the chat history it will start scrolling from near the top. I have made a quick demo of my situation http://jsfiddle.net/DY9CT/2/ Does anyone know how to solve this problem?

Why does this javascript based printing cause Safari to refresh the page?

The page I am working on has a javascript function executed to print parts of the page. For some reason, printing in Safari, causes the window to somehow update. I say somehow, because it does not really refresh as in reload the page, but rather it starts the "rendering" of the page from start, i.e. scroll to top, flash animations start from 0, and so forth. The effect is reproduced by this fiddle: http://jsfiddle.net/fYmnB/ Clicking the print button and finishing or cancelling a print in Safari causes the screen to "go white" for a sec, which in my real website manifests itself as something "like" a reload. While running print button with, let's say, Firefox, just opens and closes the print dialogue without affecting the fiddle page in any way. Is there something with my way of calling the browsers print method that causes this, or how can it be explained - and preferably, avoided? P.S.: On my real site the same occurs with Chrome. In the ex