Java project and maven project

This question already has an answer here:

  • How can I create an executable JAR with dependencies using Maven? 33 answers

  • you can generate a jar from your maven project including all dependencies.

    add the following plugin to your pom of your main maven project. the mvn assembly:single will create a additional jar ( 'projekt'-jar-with-dependencies.jar ) with all dependencies, which can be included in your non-maven project:

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>2.6</version>
      <configuration>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
      <executions>
        <execution>
          <phase>package</phase>
          <goals>
            <goal>single</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
    
    链接地址: http://www.djcxy.com/p/29640.html

    上一篇: Maven不会将依赖关系添加到jar中

    下一篇: Java项目和Maven项目