標籤:snap curl 公司郵箱 檔案 bash 驗證 net stat --
一. 基本工具安裝
1. 配置終端命令別名
vim ~/.bash_profile***********************************************# for colorexport CLICOLOR=1 alias l=‘ls -CF‘alias ll=‘ls -l‘alias la=‘ls -al‘***********************************************source ~/.bash_profile |
2. 配置git
(1) 添加git的設定檔
vim ~/.gitconfig***********************************************[user]name = "自己的中文名字"email = "公司郵箱"[color]ui = autobranch = autodiff = autostatus = auto[color "branch"]current = greenlocal = yellowremote = red[color "diff"]meta = yellow boldfrag = magenta boldold = red boldnew = green bold[color "status"]added = yellowchanged = greenuntracked = cyan[alias]st = statusdi = diffci = commitco = checkoutbr = branch*********************************************** |
(2) 產生並添加ssh密鑰,使用以下命令
ssh-keygen -t rsa -C "郵箱" |
(3) 確認已開通GitLab帳號及許可權。登入http://code.qijiayoudao.net/,在左側 profile settings中,點擊 SSH Keys,上傳自己的ssh-key,即~/.ssh/id_rsa.pub中的內容
3. 安裝JDK
(1) 從百度雲端硬碟地址http://pan.baidu.com/s/1skvJAcH下載JDK安裝檔案jdk-7u76-macosx-x64.dmg (下載時間比較長,也可以從其他同事那通過QQ傳輸)
(2) 雙擊dmg檔案進行安裝
(3) 修改.bash_profile設定檔
vim ~/.bash_profile***********************************************export JAVA_HOME=$(/usr/libexec/java_home)export PATH=$PATH:$JAVA_HOME***********************************************source ~/.bash_profile |
(4) 驗證
4. 安裝MAVEN
(1) 從百度雲端硬碟地址http://pan.baidu.com/s/1hrwHPgo下載MAVEN安裝檔案apache-maven-3.0.3-bin.tar
(2) 安裝:雙擊tar檔案解壓,移動apache-maven-3.0.3目錄到自己設定的MAVEN目錄下,建議/Users/yourName/Programs
(3) 修改.bash_profile設定檔
vim ~/.bash_profile***********************************************export MAVEN_HOME=/Users/yourName/Programs/apache-maven-3.0.3export PATH=$PATH:$JAVA_HOME:$MAVEN_HOME/binexport MAVEN_OPTS=‘-Xmn400m -Xms1024m -Xmx1024m -Xss1m -XX:PermSize=384m -XX:MaxPermSize=384m‘***********************************************source ~/.bash_profile |
(4) 添加settings.xml設定檔
mkdir ~/.m2vim ~/.m2/settings.xml***********************************************<settings><!-- 配置maven本地repository的位置,可選 --><localRepository>/Users/wangbo/.m2/repository</localRepository><!-- 配置開發人員打包jar並上傳nexus的使用者名稱和密碼 --><servers> <server> <id>nexus-releases</id> <username>admin</username> <password>[email protected]$qw</password> </server> <server> <id>nexus-snapshots</id> <username>admin</username> <password>[email protected]$qw</password> </server></servers><profiles><!-- 配置maven私服的地址,maven在構建時會先從私服嘗試下載,如找不到再從中央倉庫下載 --><profile> <id>nexus</id> <repositories> <repository> <id>nexus</id> <name>local private nexus</name> <url>http://123.57.204.47:8081/nexus/content/groups/public</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>local-plugin-repository</id> <name>local private plugin repository</name> <url>http://123.57.204.47:8081/nexus/content/groups/public</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories></profile></profiles><activeProfiles> <activeProfile>nexus</activeProfile></activeProfiles></settings>*********************************************** |
(5) 驗證
5. 安裝homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"brew -v |
6. 安裝thrift
二. 安裝mysql本地測試庫
1. 安裝本地mysql
brew install mysqlmysql.server start |
2. 建立saas使用者
mysql -uroot> CREATE USER ‘user‘@‘localhost‘ IDENTIFIED BY ‘123123‘;> GRANT ALL ON *.* TO ‘user‘@‘localhost‘;> exit |
3. 從線下測試庫(dev-01)將business和management兩個庫dump出sql檔案business_日期.sql和management_日期.sql,匯入到本地庫
mysql -usaas -p> create database business;> source business_日期.sql;> create database management;> source management_日期.sql; |
三. 拷貝代碼到本地,運行
1. 從代碼倉庫擷取backend代碼,建議放在~/Workspace/目錄下
git clone [email protected]:xxxx/backend.git |
2. 從命令列運行工程
3. 驗證,訪問http://localhost:8080/index
四. 安裝開發環境IDEA
1. 從百度雲端硬碟地址http://pan.baidu.com/s/1i4nSynb下載IDEA安裝檔案ideaIU-14.0.3.dmg
2. 雙擊dmg檔案進行安裝
3. 運行IDEA,會提示"需要安裝舊Java se 6運行環境才能開啟",點擊"更多資訊",開啟JDK6的下載也,下載安裝,再次運行IDEA
註:此時JDK7和JDK6同時存在。想要看已經安裝的JDK版本及目錄,運行命令"/usr/libexec/java_home -V";想要看預設JDK的路徑,運行命令"/usr/libexec/java_home",如下:
4. 從網上自行下載相應版本的註冊碼並啟用,可以試試這個網頁中的註冊碼:http://hw1287789687.iteye.com/blog/2153894
5. 匯入代碼
(1) 點擊Import Project,找到要匯入工程的pom.xml
(2) 保持預設設定,一路下一步;直到添加JDK路徑,點"加號"瀏覽到JDK1.7的路徑並添加,預設是/Library/Java/JavaVirtualMachines/jdk1.7.0_76.jdk/Contents/Home;最後點擊Finish
(3) 匯入完成後,可能需要等待一段時間下載依賴的maven等,待工程代碼的錯誤完全解決,點擊右上方的"Edit Configurations"添加運行項
(4) 在左側點擊"加號"並選擇Maven,在右側填寫相關的資訊及命令如
(5) 點擊右上方的Debug按鈕,運行工程,此時會彈出未配置Maven目錄的提示,點擊OK,再從底下的Event Log點擊configuration dialog,點擊Override並瀏覽到Maven的安裝目錄
(6) 再次點擊右上方的Debug按鈕,運行工程,如所示,運行成功,訪問http://localhost:8080/index驗證
java開發環境構建