自己在使用maven进行package操作时出现
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.4:single (make-assembly) on project hive-udf: Error reading assemblies: No assembly descriptors found. -> [Help 1]
错误。
通过报错信息,应该是maven-assembly-plugin的
解决方案:
第1步:
把原来的内容:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors></descriptors>
<finalName>hive-udf</finalName>
<outputDirectory>${project.build.directory}/../..</outputDirectory>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
修改为
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>../jar.xml</descriptors>
<finalName>hive-udf</finalName>
<outputDirectory>${project.build.directory}/../..</outputDirectory>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
第2步:在项目的根目录添加jar.xml
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>jar</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>runtime</scope>
<useTransitiveDependencies>false</useTransitiveDependencies>
<includes>
<include>brucedu.bigdata:*</include>
</includes>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>target/classes</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
重新执行package命令,BUILD SUCCESS!