栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

使用Maven构建完整的应用程序文件夹

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

使用Maven构建完整的应用程序文件夹

这种部署目录结构非常流行,并已被apache maven和ant等许多出色的应用程序采用。

是的,我们可以通过在maven软件包阶段使用maven-assembly-plugin来实现。

示例pom.xml:

  <!-- Pack executable jar, dependencies and other resource into tar.gz -->  <plugin>    <groupId>org.apache.maven.plugins</groupId>    <artifactId>maven-assembly-plugin</artifactId>    <version>2.2-beta-5</version>    <executions>      <execution>        <phase>package</phase>        <goals><goal>attached</goal></goals>      </execution>    </executions>    <configuration>      <descriptors>        <descriptor>src/main/assembly/binary-deployment.xml</descriptor>      </descriptors>    </configuration>  </plugin>

样本binary-deployment.xml:

<!--  release package directory structure:    *.tar.gz      conf        *.xml        *.properties      lib        application jar        third party jar dependencies      run.sh      run.bat--><assembly>  <id>bin</id>  <formats>    <format>tar.gz</format>  </formats>  <includebaseDirectory>true</includebaseDirectory>  <fileSets>    <fileSet>      <directory>src/main/java</directory>      <outputDirectory>conf</outputDirectory>      <includes>        <include>*.xml</include>        <include>*.properties</include>      </includes>    </fileSet>    <fileSet>      <directory>src/main/bin</directory>      <outputDirectory></outputDirectory>      <filtered>true</filtered>      <fileMode>755</fileMode>    </fileSet>    <fileSet>      <directory>src/main/doc</directory>      <outputDirectory>doc</outputDirectory>      <filtered>true</filtered>    </fileSet>  </fileSets>  <dependencySets>    <dependencySet>      <outputDirectory>lib</outputDirectory>      <useProjectArtifact>true</useProjectArtifact>      <unpack>false</unpack>      <scope>runtime</scope>    </dependencySet>  </dependencySets></assembly>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/610141.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号