軟件是對質(zhì)量的不懈追求

          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)  編輯  收藏


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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 皋兰县| 芮城县| 台北县| 长治市| 贵港市| 吴江市| 泰顺县| 黄浦区| 武强县| 余干县| 孟连| 上林县| 保靖县| 镇江市| 涞水县| 新干县| 塘沽区| 大洼县| 兴仁县| 措美县| 徐闻县| 桂林市| 昌宁县| 保山市| 贡嘎县| 永州市| 湘潭县| 宜州市| 盐源县| 武汉市| 方山县| 大同市| 丽江市| 雷州市| 凉城县| 财经| 若尔盖县| 德令哈市| 江都市| 宜君县| 泊头市|