Friday, August 5, 2011

Quick and dirty mavenization of a non-Maven project with plenty of JARs

Problem is: I have lots of JARs which I cannot express as dependency.
I know that including JARs in SVN is BAD, BUT...
I know that using scope=system in Maven is BAD, BUT...


Following this link

I write this tool to generate me the dependencies:

import java.io.File;


public class PrintPOM {
 public static void main(String[] args) {
  File dir = new File("C:\\pierre\\maventests\\GUFunctionalTests\\lib");
  for (File file : dir.listFiles()) {
   if (file.getName().endsWith(".jar")) {
    System.out.println("");
    System.out.println("mylibs");
    System.out.println("" + file.getName() + "");
    System.out.println("1.0");
    System.out.println("system");
    System.out.println("${project.basedir}/lib/" + file.getName() + "");
    System.out.println("");
   }
  }

 }
}


and I stick the result in my pom.xml (its POM, not PORN, you dirty man)

Here the POM documentation page, priceless!

No comments: