Maven – Package the jar file with dependencies

Sometimes we want to build a executable jar which contains all the dependencies. In this case we could make use of the maven-assembly-plugin which help us to package a jar-with-dependencies artifact during the Maven package phase. Let’s refer to the simple Maven project we did before.

 

1. First let’s introduce a dependency to our project. Say, we want to make use of the Apache Commons – Commons Lang to check the empty string. Edit the src/main/java/info/ykyuen/eureka/Addition.java as follow.
Continue reading Maven – Package the jar file with dependencies

陶傑 – 大智慧

世界上所有的民變和革命,本來都可以避免。終於發生了,是因為當權者的延誤。

法國大革命本來不必發生的,如果那年六月國王召開的「三級會議」,國王願意勸說貴族加一點稅。如果貴族階級肯多負擔點稅收,也不會有後來的革命。

不肯自動加稅,也不要緊,只要國王肯應代表的要求,兩千多名代表,一人一票,而不是沿用二百年前的舊制:貴族、教士、平民,一個階級一票。

如果國王讓了步,不會有後來的斷頭台。但是不,國王阻撓改革,不是他故意與平民作對,而是他認為拖得一天是一天,法國的平民會像過去二百年一樣,默默忍下去。

有人以為,法國大革命的原因是國王路易十六想政治改革。不對。國王根本不想改革。到進攻巴士的監獄、暴民佔領梵爾賽宮、把國王夫婦押回巴黎之後,路易十六才開始同意改革。這時他才想到英國的君主立憲,把實權讓出來,但一切已經太遲。
Continue reading 陶傑 – 大智慧

名言八十九

Whatever career you may choose for yourself – doctor, lawyer, teacher – let me propose an avocation to be pursued along with it. Become a dedicated fighter for civil rights. Make it a central part of your life. It will make you a better doctor, a better lawyer, a better teacher. It will enrich your spirit as nothing else possibly can. It will give you that rare sense of nobility that can only spring from love and selflessly helping your fellow man. Make a career of humanity. Commit yourself to the noble struggle for human rights. You will make a greater person of yourself, a greater nation of your country and a finer world to live in.

Martin Luther King

Linux – Wait until a specific pattern is written on log using tail and sed

In the Ant build.xml, i need to make sure the JBoss server is started before running the test cases. There are 2 possible approaches.

  • Using twiddle.sh to check the status
  • Monitoring server.log until “Started in” is written on it

 

I took the 2nd approach. Here is an example output log when the JBoss server is started successfully.
Continue reading Linux – Wait until a specific pattern is written on log using tail and sed

陶傑 – 腫瘤如何形成

如果二○一七年沒有公正的普選,據說香港就會墮下懸崖。

二○一七年普選這一關,中國遲遲不敢硬闖,但沒有辦法,自從收回香港主權,普選即是「港人治港」的目標。

然而拖到現在,許多親中派人士反問:「如果普選出了個『長毛』當特首,怎麼辦?」

答案是:即使第一屆普選,選出了梁國雄先生做特首,中國、香港財團、工商界,也要承受這個後果。

因為,即使視「長毛」為社會的腫瘤,也要認識,腫瘤是如何形成的。

英國管治香港的時候,長毛和他的「革馬盟」,崇尚托洛斯基,是一群無政府主義者。英國人對左翼思潮十分了解,工黨也有這一翼,譬如貴族出身的理想主義者彭東尼(Tony Benn),要求廢除皇室,行徹底的民粹。
Continue reading 陶傑 – 腫瘤如何形成