skip to Main Content

I just started to develop a java web application based on the ninjaframework. Everything works great, but: With all the ninja-dependencies, the deploy-war has around 25MB. I really hope, I won’t have to upload a 25MB java archive all the time – especially due to the fact, that the dependencies won’t barely change as often as e.g. a stylesheet of my app.

Is there a practical solution to move the ninjaframework-dependencies to a separated jar? I am working with eclipse, therefore a solution that integrates in the IDE would be great.

So far, I have had a look into the maven dependency-scoping and have (unsuccessfully) tried to move the dependencies into a separated project and refer to the project with a system-scoped dependency (which I would in my understanding be able to deploy as a separated jar file). I currently fail at building this dependency-jar with maven – but I also wonder, if there are better approaches.

I deploy the application on a tomcat-server in a plesk installation

2

Answers


  1. If you have to use all the dependencies, there is no way to avoid deploying them with your application.

    You don’t tell if you are deploying into a container (maybe Tomcat). If you do, you can try to deploy the needed libraries into the container and set the Maven scope to provided to avoid redeploying the libraries.

    Having the libraries provided by the container has benefits, but it can also be a burden. Depends strongly on your deployment and operation processes.

    Login or Signup to reply.
  2. Another option would be to exclude libraries that you don’t use. For instance if you don’t use JPA you can safely exclude it from the build via Maven’s xml tag.

    Background: Ninja 4 potentially bundles too many libraries by default. That’s cool, because everything will work out of the box without thinking about libraries needed. The downside is that the jar/war may be too big for what you want to do. There are discussions on the way to make Ninja more modular – feel free to chime in on our mailing list 🙂

    But as written above – you can cut Ninja’s bundle down yourself using Maven’s exclude.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search