maven包加载

1) IDEA包加载pom.xml配置

<build>
    <sourceDirectory>src/main/java</sourceDirectory>
       <testSourceDirectory>src/test/scala</testSourceDirectory>
       <plugins>
           <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-assembly-plugin</artifactId>
              <version>2.6</version>
    <configuration>
         <!--<descriptors>-->
         <!--<descriptor>src/assembly/assembly.xml</descriptor>-->
         <!--</descriptors>-->
    <descriptorRefs>
        <descriptorRef>jar-with-dependencies</descriptorRef>
   </descriptorRefs>
   </configuration>
<executions>
<execution>
     <id>make-assembly</id>
    <phase>package</phase>
    <goals>
        <goal>single</goal>
    </goals>
 </execution>
</executions>
</plugin>
    <plugin>
         <groupId>org.scala-tools</groupId>
        <artifactId>maven-scala-plugin</artifactId>
<executions>
<execution>
    <goals>
       <goal>compile</goal>
      <goal>testCompile</goal>
   </goals>
</execution>
</executions>
<configuration>
     <scalaVersion>${scala.version}</scalaVersion>
     <args>
     <arg>-target:jvm-1.7</arg>
     </args>
</configuration>
</plugin>
</plugins>
</build>

2) escplise包加载pom.xml配置

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>  

3)java保存

<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<!--<classpathPrefix>lib/</classpathPrefix>-->
<mainClass>org.leocook.result.decoded.ResultDecodedImportHbaseMR1</mainClass>
</manifest>
</archive>
<!--<descriptors>-->
<!--<descriptor>src/assembly/assembly.xml</descriptor>-->
<!--</descriptors>-->
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
<args>
<arg>-target:jvm-1.7</arg>
</args>
</configuration>
</plugin>
</plugins>
</build>
我不生产知识 我只是知识的搬运工
原文地址:https://www.cnblogs.com/yyy-blog/p/5668027.html