`
jbosscn
  • 浏览: 149620 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

[翻译]玩转JBoss AS7

阅读更多

原文: Hacking on AS7 - http://community.jboss.org/wiki/HackingonAS7

注:jbossas 7 使用 github 来管理源代码,所以要求阅读者有基本的git知识,可以阅读一下<<pro git>>书籍。

 

1. 创建github帐号

http://github.com

 

2. Fork 你的jboss-as 副本

http://github.com/jbossas/jboss-as

 

3. 用Git克隆你的副本到本机工作区

$ git clone git@github.com:[your user]/jboss-as.git
Initialized empty Git repository in /devel/jboss-as/.git/
remote: Counting objects: 2444, done.
remote: Compressing objects: 100% (705/705), done.
remote: Total 2444 (delta 938), reused 2444 (delta 938)
Receiving objects: 100% (2444/2444), 1.71 MiB | 205 KiB/s, done.
Resolving deltas: 100% (938/938), done.

$ cd jboss-as
 

 

4. 将git远程引用添加为upstream, 为了以后使用pull来更新

git remote add upstream git://github.com/jbossas/jboss-as.git
 

5. 使用maven (通过命令 build.sh) (确实你在使用 maven 3)

$ ./build.sh install
.....
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] JBoss Application Server: BOM ..................... SUCCESS [1.834s]
[INFO] JBoss Application Server: Parent Aggregator ....... SUCCESS [0.022s]
[INFO] JBoss Application Server: Domain Core ............. SUCCESS [3.051s]
[INFO] JBoss Application Server: Server Manager .......... SUCCESS [0.204s]
[INFO] JBoss Application Server: Server .................. SUCCESS [0.283s]
[INFO] JBoss Application Server: Domain Controller ....... SUCCESS [0.084s]
[INFO] JBoss Application Server: Process Manager ......... SUCCESS [0.314s]
[INFO] JBoss Application Server: Remoting ................ SUCCESS [0.390s]
[INFO] JBoss Application Server: Build ................... SUCCESS [5.696s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

 

6. 从 upstream 拉取(pull)更新

写道
$ git pull --rebase upstream master
From git://github.com/jbossas/jboss-as
* branch master -> FETCH_HEAD
Updating 3382570..1fa25df
Fast-forward
{parent => bom}/pom.xml | 70 ++++----------
build/pom.xml | 13 +--
domain/pom.xml | 10 ++
.../src/main/resources/examples/host-example.xml | 2 +-
.../resources/examples/jboss-domain-example.xml | 28 +++---
.../main/resources/schema/jboss-domain-common.xsd | 12 +--
.../main/resources/schema/jboss-domain-host.xsd | 2 +-
domain/src/main/resources/schema/jboss-domain.xsd | 17 ++--
pom.xml | 100 ++++++++++++++++++--
process-manager/pom.xml | 3 +-
10 files changed, 156 insertions(+), 101 deletions(-)
rename {parent => bom}/pom.xml (85%)
 

(如果你有本地提交,--rebase 会自动将你本地的提交移动到分支的顶端,便于生成清晰的提交记录,方便他人合并,如果没有本地提交,可以不加 --rebase)。 请注意 --rebase 非常重要如果你确实有本地提交。如果git pull不能快速移动指针,它会合并提交,如果不是用--rebase它会给予你本地的修改进行合并,而--rebase则是将你的修改与upstream进行合并。也就是说,一个合并提交会产生修改history,rebase会让历史更加的清晰和简单。而一旦你做了本地提交,今后将很难重建在此此提交之前的历史, 在12中还会讨论。

 

有一个办法让你不会忘记 --rebase 选项就是给"pull --rebase'创建一个别名:


$ git config --global alias.up "pull --rebase"
 

然后使用新的别名,而不是 pull

$ git up upstream master
 

 

另一个更加推崇的办法,是避免同时使用 pull 和 rebase,而是用 fetch+rebase,不过这已经超过了该文的内容,可以参考git的文档。

$ git config --global alias.up "pull --rebase"
 

 

 

7. 推送(push) 你拉取(pull)的更新到你个人的github repo

$ git push
Counting objects: 192, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (44/44), done.
Writing objects: 100% (100/100), 10.67 KiB, done.
Total 100 (delta 47), reused 100 (delta 47)
To git@github.com:[your user]/jboss-as.git
   3382570..1fa25df  master -> master
 

 

你可能加上 -f 参数用来强行提交你的修改。参考注释12

 

8. 讨论你计划的修改 (如果你想要得到反馈)

 

9. 为你的修改(增强/修复bug)发布一个JIRA

http://jira.jboss.org

 

10. 创建一个简单的主题分支(branch)来隔离这项工作 (仅作为一个推荐方法)

git checkout -b my_cool_feature
 
Note: See tips section for how to use a nice git prompt for tracking what branch you are in!

11. 不断的修改并且提交你的修改 (不要忘了push)

git commit -m 'JBAS-XXXX Frunubucate the Fromungulator'
git commit -m 'JBAS-YYYY Tripple Performance of Fromungulation'
git push my_cool_feature
 

 

注意 git push 默认引用你正在push的branch,默认为 master,而不是你正在工作的branch.

 

12. 给予master分支的最新更新重建/衍合(rebase)你的分支(将你的提交更新到master的顶端)

git fetch upstream
git rebase -i upstream/master
# if you have conflicts fix them and rerun rebase
# The -f, forces the push, alters history, see note below
git push -f origin my_cool_feature
 

 

选 项-i会启动交互式的更新,它允许你组合提交,调整commit信息等。这是一个好的方法使得commit日志非常清晰对于外部的更新。注意这会修改提交 历史,产生干净的patch,对于其他已经fork你的分支的人并不友好。所以,你需要确认要么你工作在一个没有共享的分支上,或者你共享了则需要告诉他 们你将修订分支的历史(因此一旦是推送完毕之后,他们需要给予你分支的顶部做rebase)。

 

 

 

 

 

 

13. 将你的修改merge到upstream

  1. 在你请求将你的更新合并到upstream之前,请重复步骤12,确认你的repo和upstream是同步的。
  2. 发送一个pull request email to jbossas-pull-requests@lists.jboss.org (要加入这个list,参考 here ),附上你的repo的链接,描述你的修改,谁检查你的改动(如果有的话)
  3. 在检查之后,管理员会合并你的patch,update/resolve你请求中问题,并回复什么时候完成
  4. 不会忘了切换会master分支,并且拉取更新
git checkout master
git pull upstream master
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics