打包报错无效的目标发行版
有可能的原因:环境变量JAVA_HOME所指向路径的java版本与java命令的版本不一致,参考:记一个maven编译打包低级错误”Fatal error compiling: 无效的目标发行版: 11”的解决。
限制模块被Install或Deploy
在Maven多模块项目中,某些非基础jar包的模块,是不需要被install到本地或deploy到私有仓库的,可以通过如下2种不同的方式进行限制。
方式一:属性配置
在不需要被install或deploy的模块中配置如下属性:
<properties>
<!-- 跳过远程部署 -->
<maven.deploy.skip>true</maven.deploy.skip>
<!-- 跳过本地安装 -->
<maven.install.skip>true</maven.install.skip>
</properties>
方式二:插件配置
在不需要被install或deploy的模块中配置如下插件:
<build>
<plugins>
<!-- 跳过本地安装 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.4</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<!-- 跳过远程部署 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达,在下面评论区告诉我^_^^_^