java - Too much dependecies into jar with maven -


i packaging spark project 1 jar file when compile maven includes lot jars (100mb, size!!) not org/log4j/* dependencies (it generates error in execution time), adds others jboss/netty/* jar.

i suppose dependencies included each other, must assume 100 mb ¿?, not include dependencies org/log4j/*

¿are there way include 10 jars specified maven xml file? :

 <dependencies>       <dependency>           <groupid>junit</groupid>           <artifactid>junit</artifactid>           <version>4.12</version>           <scope>test</scope>       </dependency>       <dependency>           <groupid>log4j</groupid>           <artifactid>log4j</artifactid>           <version>1.2.17</version>     </dependency>       <dependency>           <groupid>org.apache.commons</groupid>           <artifactid>commons-io</artifactid>           <version>1.3.2</version>       </dependency>       <dependency>           <groupid>org.apache.commons</groupid>           <artifactid>commons-lang3</artifactid>           <version>3.5</version>     </dependency>     <dependency>       <groupid>commons-codec</groupid>       <artifactid>commons-codec</artifactid>       <version>1.9</version>     </dependency>       <dependency>           <groupid>com.google.code.gson</groupid>           <artifactid>gson</artifactid>           <version>2.6.2</version>       </dependency>       <dependency>           <groupid>org.json</groupid>           <artifactid>json</artifactid>           <version>20170516</version>       </dependency>       <dependency>           <groupid>org.apache.hadoop</groupid>           <artifactid>hadoop-common</artifactid>           <version>2.8.1</version>       </dependency>       <dependency>           <groupid>org.apache.spark</groupid>           <artifactid>spark-sql_2.10</artifactid>           <version>${spark.version}</version>       </dependency>       <dependency>           <groupid>org.apache.spark</groupid>           <artifactid>spark-core_2.10</artifactid>           <version>${spark.version}</version>       </dependency>       <dependency>           <groupid>com.databricks</groupid>           <artifactid>spark-csv_2.10</artifactid>           <version>${spark.version}</version>       </dependency>   </dependencies> 

to create 'jar-with-dependencies' use plugins:

   <plugin>                 <artifactid>maven-dependency-plugin</artifactid>                 <executions>                     <execution>                         <phase>process-sources</phase>                         <goals>                             <goal>copy-dependencies</goal>                         </goals>                         <configuration>                             <outputdirectory>${targetdirectory}</outputdirectory>                         </configuration>                     </execution>                 </executions>             </plugin>             <plugin>                 <artifactid>maven-assembly-plugin</artifactid>                 <version>2.6</version>                 <configuration>                     <descriptorrefs>                         <descriptorref>jar-with-dependencies</descriptorref>                     </descriptorrefs>                 </configuration>                 <executions>                     <execution>                         <phase>package</phase>                         <goals>                             <goal>single</goal>                         </goals>                     </execution>                 </executions>             </plugin> 

thanks

there dependency tree, i.e. dependencies pulling in own dependencies , on.

to show tree use

mvn dependency:tree 

see https://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -