顯示具有 maven 標籤的文章。 顯示所有文章
顯示具有 maven 標籤的文章。 顯示所有文章

2013年3月17日 星期日

Put Spring's applicationContext.xml into src/main/resources folder

The standard folder layout of Maven is quite convenient for me, the applicationContext.xml is put into /webapp/WEB-INF instead of /src/main/resources folder. It conflicts the convention of Maven, therefore I add the following command in web.xml in order to load applicationContext.xml from /webapp/WEB-INF folder.

    contextConfigLocation
    classpath:applicationContext.xml

Reference: stackoverflow

2012年6月21日 星期四

如何看Homebrew某個Fomula所包含的版本

以Maven為例
$ brew versions maven
#3.0.4    git checkout 1dc42b3 /usr/local/Library/Formula/maven.rb
#3.0.3    git checkout 14e4db3 /usr/local/Library/Formula/maven.rb
#3.0.2    git checkout 03b288a /usr/local/Library/Formula/maven.rb
#3.0.1    git checkout 83857d6 /usr/local/Library/Formula/maven.rb
#3.0      git checkout 09a0264 /usr/local/Library/Formula/maven.rb
#2.2.1    git checkout d40d419 /usr/local/Library/Formula/maven.rb

# install the specific version of Maven
# usage: brew switch [formula] [version]
brew switch maven 3.0.3
brew install maven

2012年4月12日 星期四

[Fixed] 使用Maven時遇到"Failed to parse plugin descriptor for org.apache.maven.plugins:maven-resources-plugin:2.5..."錯誤

錯誤訊息大致上是"Failed to parse plugin descriptor for org.apache.maven.plugins:maven-resources-plugin:2.5...",
當遇到這個問題時,只要移除.m2/裡面的maven-resource-plugin資料夾,再重新執行即可
rm -rf ~/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.5
mvn compile
Reference: stackoverflow

2012年3月22日 星期四

用Maven清除沒有用到的library

Project在開發的過程中,總是會取捨著使用library,
當你需要清除掉目前沒有使用到的library,就可以藉由下列指令去達到
mvn dependency:analyze
Reference: stackoverflow

2012年2月22日 星期三

2011年10月6日 星期四

讓Maven可以deploy war到遠端Tomcat

修改tomcat-user.xml (在 tomcat安裝目錄/conf/ 裡面),然後重新開啟Tomcat



   
   
   
   
  


修改pom.xml,設定Tomcat位置及登入配置
 
  ${WAR_NAME}
  
   
    maven-war-plugin
    2.1.1
    
     WEB-INF/web.xml
    
   

   
    org.codehaus.mojo
    tomcat-maven-plugin
    
     http://${IP}:8080/manager/html
     ${ACCOUNT}
     ${PASSWORD}
     ${finalName}
    
   
  
 

2011年9月1日 星期四

Maven: 安裝3rd party的函式庫,以wax_1.0.4.jar為例

經常會有在Maven Repository上找不到,專案上又需要的函式庫,這個時候就必須要自己安裝這個函式庫
mvn install:install-file -DgroupId=java.ociweb -DartifactId=wax 
-Dversion=1.0.4 -Dpackaging=jar    -Dfile=/path/to/file/wax_1.0.4.jar 
-Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true

pom.xml也做對應的修改


	java.ociweb
	wax
	1.0.4

2011年8月23日 星期二

在CentOS 5.5上安裝Jenkins

安裝Jenkins
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
yum install jenkins

安裝後小小設定
chkconfig jenkins on

# listen port 8080
service jenkins start  

Log檔案位置
/var/log/jenkins/jenkins.log



Reference: jenkins-ci.org

使用Maven遇到"java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file"錯誤

筆者在使用JAX-RS (Jersey)及Java EE 6 API時,執行"mvn test",會出現類似以下的錯誤
java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/ws/rs/core/MediaType
...
原因是Java EE 6只是一個Interface,必須要等到hibernate jars讀取進來,實作這些JPA interface,因此要調整Java-ee-api在pom.xml裡面的位置,才不會出現這個錯誤。


	com.sun.jersey
	jersey-server
	1.0.1




	org.hibernate
	hibernate-core
	3.6.6.Final



	org.hibernate
	hibernate-entitymanager
	3.6.6.Final



	org.hibernate
	hibernate-validator
	4.0.2.GA




	javax
	javaee-api
	6.0
	provided

Reference: stackoverflow

2011年8月22日 星期一

如何跳過Maven的Unit Test

mvn package -Dmaven.test.skip=true
OR
mvn package -DskipTests
Reference: mkyong

2011年8月11日 星期四

遇到"javax.persistence.OneToMany.orphanRemoval()Z"錯誤

# 因為使用到了persistence-api-1.0.jar,要改用2.0 API
# 修改pom.xml

  org.hibernate
  hibernate-entitymanager
  3.6.6.Final
 
Reference: stackoverflow