有時你的工程裏會和你的Spark環境出現包衝突,這時候能夠用Maven shade將你的包名重命名,在maven里加上:apache
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>org.apache.curator</pattern>
<shadedPattern>mypackage.mycurator</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" />
</transformers>
</configuration>
</execution>
</executions>
</plugin>maven
這樣就能夠將org.apache.curator包改爲mypackage.mycurator包,避免了包衝突。orm