java - 为 git 提交的代码构建 Maven

标签 java git maven gradle ant

是否有像 maven、gradle 这样的构建工具支持只构建暂存/提交的代码而不包括未暂存/未跟踪的文件。

基本上在开发过程中会出现一些情况,我想检查提交的包和未提交的包。虽然我可以实现两个不同的目录,但任何构建工具的这种灵 active 都会有很大帮助。

例如:假设我有一个 maven 项目,我修改并提交并将代码推送到 GIT Repo。后来我开始进一步开发。当我构建时,它构建包括所有文件,但我想知道是否有任何我可以跳过 maven pom.xml 中未暂存/未跟踪的文件以仅构建提交的文件。任何有助于实现此目的或任何其他构建工具的插件。

最佳答案

我认为git stash为此派上用场:

Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the HEAD commit.

关于java - 为 git 提交的代码构建 Maven,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36546427/

相关文章:

Git Integration Manager Workflow——一个还是多个存储库?

git - 无法使用 git 存储库创建网站并从 Team Foundation 服务发布

Maven 组装插件 : how to include provided dependencies of transitive dependencies

java - 从 java 应用程序实例化 PApplet

java - 使用 CompletableFuture 重试逻辑

java - 布局切换时 View 会发生什么情况?

java - 如何在不阅读源代码的情况下找到 Maven 插件的默认目标?

java - RMI NotSerializableException 尽管它是一个远程对象

ruby - 是否可以在不先获取远程 git repo 信息的情况下获取它?

maven - Gradle构建脚本无法通过HTTP代理下载Nexus Artifact -收到HTTP 503错误