DEV Community

rafaone
rafaone

Posted on

How to use maven to download jars for static project

If you have a old style java project that you just copy the jar files to 'JRE/lib/ext' you can you maven to do this job.

Create a maven app , edit you pom.xml, and put all your dependencies into dependencies block.

<dependencies>
      <dependency>      
        <groupId>org.deeplearning4j</groupId>      
        <artifactId>deeplearning4j-core</artifactId>
        <version>1.0.0-beta5</version>    
      </dependency>         
      <dependency>      
        <groupId>org.deeplearning4j</groupId>      
        <artifactId>deeplearning4j-modelimport</artifactId>      
        <version>1.0.0-beta5</version>    
      </dependency>                       
      <dependency>      
        <groupId>org.nd4j</groupId>      
        <artifactId>nd4j-native-platform</artifactId>
        <version>1.0.0-beta5</version>    
      </dependency>
      <dependency>      
        <groupId>com.google.cloud.dataflow</groupId>      
        <artifactId>google-cloud-dataflow-java-sdk-all</artifactId>  
        <version>2.5.0</version>     
      </dependency>
   </dependencies>
Enter fullscreen mode Exit fullscreen mode

Then ou can create your package, open a terminal navigate to your project and execute the command:

mvn package

After the BUILD you can copy only the jars that the project uses (also all dependencies), using the next command:

mvn dependency:copy-dependencies

Image description

And check the folder "target/dependency" and all jars will be stored into this folder, and you can copy this for your JRE/lib/ext.

Top comments (0)