klocwork-11問題彙總

安裝問題

安裝時報錯: exec: 10: /home/ … /cahoots/exec/ix86-pc-linux/kwupdate: not found

The 32-bit compatibility libraries must be installed. Cahoots works on 64-bit platforms in 32-bit emulation mode, so in order for Cahoots to work on Linux 64-bit platforms, you must ensure that the 32-bit libraries are installed. The way you check and install 32-bit libraries depends on your Linux distribution. For example, for Ubuntu, run the following command to install 32-bit compatibility libraries:
即,需要安裝一些32位的系統環境文件:

sudo apt-get install ia32-libs

如何從Maven源代碼文件中生成Ant build file

klocwork目前不支持maven編譯分析,需要將maven的編譯腳本pom.xml轉換成ant的build.xml。

  • 首先安裝maven環境,ubuntu系統直接 sudo apt-get install maven
  • 安裝jdk,如果圖方便,可以直接用 sudo apt-get install openjdk-8-jdk 安裝openjdk,然後設置環境變量:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 
  • 在擁有pom.xml文件的源代碼根目錄下執行: mvn ant:ant,結束後,根目錄下生成了 build.xml 文件,可以直接實現 ant 編譯了。
$mvn ant:ant
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'ant'.
[INFO] artifact org.apache.maven.plugins:maven-ant-plugin: checking for updates from central
...
[INFO] ------------------------------------------------------------------------
[INFO] Building abc
[INFO]    task-segment: [ant:ant]
[INFO] ------------------------------------------------------------------------
...
Downloading: http://repo1.maven.org/maven2/xalan/xalan/2.7.0/xalan-2.7.0.pom
491b downloaded
...
Downloading: http://repo1.maven.org/maven2/xalan/xalan/2.7.0/xalan-2.7.0.jar
2666K downloaded
[INFO] [ant:ant]
[INFO] Wrote Ant project for ABC to D:\Project_ABC
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 28 seconds
[INFO] Finished at: Thu Feb 12 16:16:15 SGT 2009
[INFO] Final Memory: 9M/16M
[INFO] ------------------------------------------------------------------------
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章