`
13146489
  • 浏览: 246294 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

deploy as jar

 
阅读更多
原文地址:http://stackoverflow.com/questions/2022032/building-a-runnable-jar-with-maven-2
The easiest way to do this would be to create an assembly using the maven-assembly-plugin and the predefined jar-with-dependencies descriptor. You'll also need to generate a manifest with a main-class entry for this uber jar. The snippet below shows how to configure the assembly plugin to do so:

<build>
  <plugins>
    <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
        <archive>
          <manifest>
            <mainClass>fully.qualified.MainClass</mainClass>
          </manifest>
        </archive>
      </configuration>
    </plugin>
  </plugins>
</build>
Then, to generate the assembly, just run:

mvn assembly:assembly
If you want to generate the assembly as part of your build, simply bind the assembly:single mojo to the package phase:

<build>
  <plugins>
    <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
        <archive>
          <manifest>
            <mainClass>fully.qualified.MainClass</mainClass>
          </manifest>
        </archive>
      </configuration>
      <executions>
        <execution>
          <phase>package</phase>
          <goals>
            <goal>single</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>
And simply run:

mvn package
分享到:
评论

相关推荐

    restful restful所需要的jar包

    restful restful所需要的jar包 ========================================= Restlet, a RESTful Web framework for Java ========================================= http://www.restlet.org -------------------...

    deploy-jboss-plugin

    部署jboss插件插件以域和独立模式将工件部署到JBoss AS和JBoss EAP。汇编git clone git@github.com:Daniel69/deploy-jboss-plugin.git cd deploy-jboss-plugin/ mvn clean install -DskipTests=true安装假设Jenkins...

    详解Android类加载ClassLoader

    基本知识 Java的类加载设计了一套双亲代理的模式,使得用户没法替换系统的核心类,从而让应用更安全。所谓双亲代理就是指,当加载类的时候...比如:charsets.jar、deploy.jar、javaws.jar、jce.jar、jfr.jar、jfxswt.

    distroless-bazel:最小的bazel容器图像

    Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Fri Jun 8 12:17:35 2018 (1528460255) Build timestamp: 1528460255 Build timestamp...

    openoffice jodconverter(2.2.2).zip

    * a web application that you can deploy into any servlet container (e.g. Apache Tomcat) * a command line tool (java -jar jodconverter-cli-2.2.2.jar &lt;input-document&gt; ) Requirements ============ ...

    J/Invoke 2010 jinvoke jni 天涯浪子

    J/Invoke enables Java developers to easily invoke native methods (such as the Win32 API or C-based Windows DLLs and Unix dynamic libraries) with pure Java code. Unlike error-prone JNI programming ...

    Learning Apache Karaf

    Karaf supports hot deployment of OSGi bundles by monitoring jar files inside the [home]/deploy directory. Each time a jar is copied in this folder, it will be installed inside the runtime. You can ...

    jboss in action

    or configure the technology in the environment in which you wish to deploy it. If your deployment environment of choice is the JBoss Application Server, then this book is for you because it covers ...

    java7帮助文档

    Security Int'l RMI IDL Deploy Monitoring Troubleshoot Scripting JVM TI JRE RIAs Java Web Start Applet / Java Plug-in User Interface Toolkits AWT Swing Java 2D Accessibility Drag n Drop Input ...

    JavaSE-6.0-英文手册(2008/11/30_FullUpdate)

    Security Int'l RMI IDL Deploy Monitoring Troubleshoot Scripting JVM TI JRE Deployment Technologies Deployment Java Web Start Java Plug-in User Interface Toolkits AWT Swing Java 2D ...

    Maven权威指南 很精典的学习教程,比ANT更好用

    Assemblies as Dependencies 12.2.4. Assembling Assemblies via Assembly Dependencies 12.3. Overview of the Assembly Descriptor 12.4. The Assembly Descriptor 12.4.1. Property References in ...

Global site tag (gtag.js) - Google Analytics