-1

I have an old project. I am trying to add maven build to the project. All the jar files in the project are present currently in the WEB-INF/lib folder.

Is there a way to add these jar files to the classpath during source compilation and then have it in the war file lib

BJ5
  • 512
  • 6
  • 22

1 Answers1

1

This is one of the places where switching to Maven hurts. There are a lot of suggestions where most short-circuit something you will need later, and hurt you there. I would suggest that you

  • Move your jar files out of the lib folder into another project folder not meaning anything special to Maven.
  • For all jars that you easily recognize, make the proper Maven dependency in your pom file. This will allow Maven to download sources and javadoc if present.
  • For the remaining jars, you can tell Maven to install them as part of your normal build as custom dependencies. I asked the same question years back and got a very useful response at Multiple install:install-file in a single pom.xml. This will allow you to get up and running quickly.
  • When you have the time, locate proper replacements for your custom dependencies.

Take your time doing this. It is tedious work but it pays off quickly.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
  • I have a lot of jar files very old ones. I think I better stick with Ant. It would be good, if maven can support this in future – BJ5 Dec 27 '18 at 09:17
  • Ant has disadvantages but if you have something that works then good for you. Maven will most likely never support this. – Thorbjørn Ravn Andersen Dec 27 '18 at 11:09