I developed a project using maven same project source code and dependencies i want to use in gradle project.so i added dependencies corresponding to gradle in my project.but with gradle i am even not able to compile also could you please let me know what can be the issue.I tried hard to find out the issue but unable to figure it out: my complete pom file is as follows:
4.0.0
<groupId>com.abc</groupId>
<artifactId>Abc</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Abc</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hadoop.version>2.2.0</hadoop.version>
<hive.version>1.2.1</hive.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-client</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<version>${hadoop.version}</version>
<classifier>tests</classifier>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapred</artifactId>
<version>0.22.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-minicluster</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-common</artifactId>
<version>${hive.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-service</artifactId>
<version>${hive.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-metastore</artifactId>
<version>${hive.version}</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.11.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-jdbc</artifactId>
<version>${hive.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<phase>package</phase>
<id>create-my-bundle</id>
<goals>
<goal>single</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/jars</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/jars</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<jettyXml>
${project.basedir}/src/main/resources/configuration.xsl
</jettyXml>
</configuration>
</plugin>
</plugins>
</build>
And my gradle build file is as follows:
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'maven-publish'
repositories {
mavenLocal()
mavenCentral()
/* jcenter()*/
}
configurations.all {
resolutionStrategy.eachDependency {
if(it.requested.name == 'log4j') {
it.useTarget 'log4j:apache-log4j-extras:1.2.16'
}
}
}
/*configurations.all {
resolutionStrategy.force ‘log4j:log4j:1.2.17’,'log4j:apache-log4j-extras:1.2.17’
resolutionStrategy.force ‘log4j:log4j:1.2.16’,'log4j:apache-log4j-extras:1.2.16’
resolutionStrategy.force ‘log4j:log4j:1.2.16’, ‘log4j:log4j:1.2.17’
}*/
dependencies {
compile 'org.apache.curator:curator-framework:2.6.0’
compile 'org.apache.curator:curator-client:2.6.0’
compile ‘org.apache.curator:curator-recipes:2.6.0’
compile 'commons-cli:commons-cli:1.2'
compile 'org.apache.commons:commons-lang3:3.0'
compile 'org.apache.hadoop:hadoop-client:2.2.0'
compile group:'org.apache.hadoop', name:'hadoop-hdfs', version:'2.2.0'
compile group:'org.apache.hadoop', name:'hadoop-hdfs', version:'2.2.0', classifier:'tests'
compile 'org.apache.hadoop:hadoop-mapred:0.22.0'
compile 'org.apache.hadoop:hadoop-core:1.1.2'
compile 'org.apache.hadoop:hadoop-minicluster:2.2.0'
compile 'org.apache.hadoop:hadoop-client:2.2.0'
compile 'commons-configuration:commons-configuration:1.10'
compile 'xerces:xercesImpl:2.9.1'
compile 'xalan:xalan:2.7.1'
compile 'org.apache.hive:hive-common:1.2.1'
compile 'org.apache.hive:hive-service:1.2.1'
compile 'org.apache.hive:hive-metastore:1.2.1'
compile 'org.apache.derby:derby:10.11.1.1'
compile 'org.apache.hive:hive-jdbc:1.2.1'
testCompile "junit:junit:4.11"
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId 'com.datametica.hiveunit’
artifactId 'hive_unit’
version '1.0-SNAPSHOT’
from components.java
}
}
}
task showMeCache << {
configurations.compile.each { println it }
}
task fatJar(type: Jar) {
baseName = project.name
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } {
// exclude 'META-INF/MANIFEST.MF’
exclude '**/datanucleus-..jar’
exclude 'META-INF/.SF’
exclude ‘META-INF/.DSA’
exclude 'META-INF/.RSA’
}
with jar
}
and i am not able to compile program due to conflicts in hadoop-core and hive common jar and commons cli jar but i am not facing these issues in maven project could you please let me know why this can happen?