mvn clean compile assembly:可以正常工作,但是mvn install或package无法创建具有依赖项的jar

时间:2018-06-29 14:42:33

标签: maven pom.xml

我是Maven的新手。我下面的pom.xml如果使用下面的cmd可以完美地创建具有依赖项的jar:

mvn clean compile assembly:single

但是如果我在下面使用cmd jar,就会创建没有依赖项。我的pom.xml出了什么问题

mvn install or mvn package

  <build>
    <finalName>TestProcess</finalName>
    <pluginManagement><!-- lock down plugins versions to avoid using Maven 
         defaults (may be moved to parent pom) -->
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>3.1.0</version>
                <configuration>
                        <appendAssemblyId>false</appendAssemblyId>
                        <descriptorRefs>
                         <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <archive>
                        <manifest>
                    <mainClass>com.ge.db.extract.ExtractDBProcess</mainClass>
                        </manifest>
                        </archive>
                    </configuration>
                   <executions>
                      <execution>
                       <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                          <goal>single</goal>
                        </goals>
                       </execution>
                 </executions>
        </plugin>
      </plugins>
     </pluginManagement>
     </build>
    </project>

0 个答案:

没有答案