首页 > 其他分享 >maven 打包源代码

maven 打包源代码

时间:2023-06-28 14:34:02浏览次数:39  
标签:fork no jar maven source sources 源代码 打包


前言

maven"内置插件"中没有打包源代码的插件,所以,需要开发者配置插件。apache提供了maven-source-plugin插件用于打包源代码。


maven-source-plugin


The Source Plugin has five goals:

  • source:aggregate aggregrates sources for all modules in an aggregator project.
  • source:jar is used to bundle the main sources of the project into a jar archive.
  • source:test-jar on the other hand, is used to bundle the test sources of the project into a jar archive.
  • source:jar-no-fork is similar to jar but does not fork the build lifecycle.
  • source:test-jar-no-fork is similar to test-jar but does not fork the build lifecycle

配置


在《maven实战》一书中,配置使用的是jar-no-fork


<build>
			<plugins>
				<plugin>
					<artifactId>maven-source-plugin</artifactId>
					<version>2.1.2</version>
					<executions>
						<execution>
							<goals>
								<goal>jar-no-fork</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
			</plugins>
	</build>






jar-no-fork与jar的区别






jar,在执行goal之前,执行generate-sources阶段,也就是说,如果,jar绑定的目标在generate-sources之后(比如verify)的话,generate-sources会执行两遍。


  • The goal is thread-safe and supports parallel builds.
  • Binds by default to the lifecycle phase: package


jar-no-fork,没有其余动作,在绑定的phase执行。原文是,



  • The goal is thread-safe and supports parallel builds.
  • Binds by default to the lifecycle phase: package.




为什么会有jar-no-fork?


临时,我也没找到它存在的理由。




参考


maven-source-plugin doc


difference between maven-source-plugin-jar-and-jar-no-fork-goal

标签:fork,no,jar,maven,source,sources,源代码,打包
From: https://blog.51cto.com/u_15561616/6571881

相关文章

  • python zipfile 打包压缩 层级过多的解决措施
    zipfile使用详细https://www.cnblogs.com/yyds/p/6427349.html解决方案https://blog.csdn.net/csrh131/article/details/107895772操作案例和总结https://blog.51cto.com/u_16055028/6475844https://mp.weixin.qq.com/s/2RDCnQLORmn8kMHJsOhenA......
  • Maven私服搭建--Nexus Linux环境
    1、下载nexus官网(需要登录才能下载)https://www.sonatype.com/products/sonatype-nexus-oss-downloadnexus的文档 可以直接下载 https://help.sonatype.com/repomanager3/product-information/downloadLinux环境下载第一个即可2、上传压缩包并解压tarxfnexus-3.56......
  • 为什么现代的低代码开发平台都不支持导出源代码?
    摘要:本文由葡萄城技术团队于博客园原创并首发。转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具、解决方案和服务,赋能开发者。初次接触低代码的程序员大多会纠结一个问题,为什么功能越强大的低代码开发平台越不会提供导出源代码的功能?要想回答这个问题,我们得回顾一......
  • eclipse中使用maven插件的有关问题:Updating index central|http://repo1.maven.org/m
    eclipse中使用maven插件的问题:Updatingindexcentral|http://repo1.maven.org/maven2问题产生如下:因为单位使用了过滤,访问Internet时,超过10M的内容就拒绝。因为maven插件在初始时,需要下载Maven的index文件,这个文件比较大,有38M多,下载不成功。所以造成使用Maven添加依赖项时(AddDep......
  • maven 推送远程仓库deploy
    pom配置<distributionManagement><repository><id>maven-private</id><name>maven-private</name><url>http://ip:8081/repository/maven-private/</url></repository></distributionManagement>......
  • Maven构建项目后项目报Error错误Java compiler level does not match the version of
     Maven构建项目后项目报Error错误JavacompilerleveldoesnotmatchtheversionoftheinstalledJavaprojectfac 项目->右键->Properties->ProjectFacets->修改facets中Java版本(下拉箭头出)为要用的版本Maven构建项目需注意1.项目右键->Properties->buildpath->jdk2.项......
  • 使用 PDF一机一码加密大师,加密打包PDF文件(一机一码,绑定机器,无需额外安装阅读器)
    PDF一机一码加密大师,可以加密任意PDF文档,添加一机一码授权,静态密码等,可以禁止用户复制,打印PDF文档中的内容,并且加密生成的PDF在其他用户电脑上无需安装第三方阅读器即可直接阅读。 下载地址:点击进入下载页面 特性 1.支持一机一码加密,可以防止PDF文件未授权的分发......
  • maven核心,pom.xml详解(转) 附录A mave的依赖范围 附录B maven常用命令集
    什么是pom?   pom作为项目对象模型。通过xml表示maven项目,使用pom.xml来实现。主要描述了项目:  -包括配置文件;  -开发者需要遵循的规则,  -缺陷管理系统,  -组织和licenses,  -项目的url,  -项目的依赖性,  -以及其他所有的项目相关因素。 快速......
  • dist/打包/内网/外网
    ##含义打包是指将项目的源代码、依赖和资源文件等进行处理和转换,最终生成可供部署和运行的静态文件集合的过程。而`dist`文件夹是存放打包生成的文件的目录。一般来说,在打包过程中,自动化构建工具会根据项目的配置和规则,将源代码进行转换、压缩和优化,并将生成的静态文件输出到......
  • gradle转maven
    背景说明前段时间接手一个项目,项目的构建用的是gradle,因为某些特殊的要求需要转内网开发,没办法,在时间不是很充裕的情况下,项目转向maven。实现方式module根目录下,build.gradle里面添加applyplugin:'java'applyplugin:'maven'添加后,右侧Gra......