【发布时间】:2018-01-04 04:44:20
【问题描述】:
我正在使用 Maven 开发一个 Java 项目,我需要经常部署到两个不同的 weblogic 环境。这 2 个部署之间的唯一区别是这 2 个文件中的大量更改:pom.xml 和 weblogic.xml 文件。其余文件相同。
我们为此创建了 2 个 GIT 分支:dev 和 parallel-dev。
但是我们在维护和合并这两个分支之间的更改时遇到了很多问题。
所有更改都在parallel-dev 分支中完成,一旦此代码经过审核和批准,我们会将其合并到dev 分支,除了不需要合并的那两个文件(除非 pom版本被修改——在这种情况下,我们只需要合并版本更改,而不是 pom.xml 中的其余更改)。这有点乱。
我认为这种方法很混乱,可以改进,但看不出如何。我很想为这个过程保留一个分支,并避免我们面临的所有那些疯狂的合并。
任何建议将不胜感激。
-- 编辑--
pom.xml 中的区别只是parallel-dev 分支的配置文件不同:
<profiles>
<profile>
<id>parallel-dev</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
<includes>
<include>env.properties</include>
<include>more.properties</include>
...
</includes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>env.properties</exclude>
<exclude>more.properties</exclude>
...
</excludes>
</testResource>
</testResources>
</build>
</profile>
在weblogic.xml 中,区别在于上下文根名称和库引用(这个库也有并行开发和开发分支)。
【问题讨论】:
-
可能在 .gitignore 中声明文件,这样它们就不会被提交
-
@Lino
pom.xml?不!这 100% 需要承诺。 -
你能把 pom.xml 和 weblogic.xml 分开吗?剩下的代码只有一个分支吗?
-
pom文件有哪些变化?依赖项?比制作两个具有不同依赖关系的不同模块...
-
这到底意味着你在不同环境下只有属性文件不同...github.com/khmarbaise/multienv-maven-plugin
标签: java git maven merge branching-and-merging