軟件是對質量的不懈追求

          Building Standalone Application with Maven2

          If you are building standalone application in Java, Maven is your friend when packing your application,
          There are two way to let Maven package your application, either as a single jar with all your dependencies jar.


           <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
             <descriptorRefs>
              <descriptorRef>jar-with-dependencies</descriptorRef>
             </descriptorRefs>
            </configuration>
           </plugin>



          One advantage if you choose to do this way is if you need to sign your application jar.
          This is needed if you are building a Java Web Start client and you need more access than connecting back to the server.
          To read more about have Maven signing your jar read http://maven.apache.org/plugins/maven-jar-plugin/usage.html.
          But if you choose to go this way, make sure that all license agreement are shipped with your one single jar.

          Another way is to let Maven package your source code only and then referring the dependent jar file from the MANIFEST file.


           <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
             <archive>
              <manifest>
               <addClasspath>true</addClasspath>
               <mainClass>se.msc.adapter.Main</mainClass>
               <classpathPrefix>lib/</classpathPrefix>
              </manifest>
             </archive>
            </configuration>
           </plugin>

          posted on 2011-02-24 13:03 BlakeSu 閱讀(335) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 阳江市| 贵阳市| 叙永县| 本溪| 余干县| 聂荣县| 厦门市| 临颍县| 乳源| 英超| 萨嘎县| 铁岭县| 莱阳市| 越西县| 板桥市| 北辰区| 英吉沙县| 台中市| 绥中县| 汽车| 会东县| 怀集县| 杨浦区| 呼伦贝尔市| 铁岭市| 开鲁县| 麻江县| 永修县| 山阳县| 湘潭市| 塘沽区| 吉安市| 玉树县| 玉山县| 峨眉山市| 隆林| 河津市| 右玉县| 获嘉县| 东平县| 阜南县|