よくやる作業をメモ。
Create New Project
1
- 左ペイン: Gradle
- Project SDK: 1.8
- Additional Libraries and Frameworks: Java
2
- GroupId: package 名
- ArtifactId: version なしの jar 名
- version: 1.0-SNAPSHOT (SNAPSHOT は Nightly build のこと)
Maven – Guide to Naming Conventions
https://maven.apache.org/guides/mini/guide-naming-conventions.html
3
- Use auto-import をチェック
- Create directories for empty content roots automatically をチェック
- Use default gradle wrapper を選択
4
- Project name: ArtifactId と同じになる
作成後
- VCS > Enable Version Control Integration... > Git
git config user.email "<メールアドレス>"
brew install gibo
gibo JetBrains java > .gitignore
気付いたら.gitignoreはgiboで自動生成する時代になっていた - Qiita
http://qiita.com/tmknom/items/c4bcebe17d25381fa45d
- File > Project Structure...
- Project > Project language level: 8
- VCS > Git > Add
- VCS > Commit Changes...
Github で複数アカウントを使っている場合
.git/config の url にアカウント名をいれたらうまくいった。
[remote "origin"]
url = https://<アカウント名>@github.com/<チームアカウント名>/<リポジトリ名>.git
credential-osxkeychain を使っている場合、keychan 上にアカウント分の設定 (https://github.com/) を作ってあげる。
Caching your GitHub password in Git - User Documentation
https://help.github.com/articles/caching-your-github-password-in-git/
Lombokを使う
build.gradle で war プラグインを使うと、providedCompile が使える。
build.gradle
...
apply plugin: 'war'
dependencies {
providedCompile "org.projectlombok:lombok:1.16.6"
...
}
IntelliJ
annotation processor を有効にする。忘れがちなので気をつける。
IntelliJ IDEA > Preferences... > Build, Execution, Deployment > Annotation Processors > Enable annotation processing
Spockを使う
build.gradle
...
apply plugin: 'groovy'
...
dependencits {
...
compile "org.codehaus.groovy:groovy-all:2.4.1"
testCompile "org.spockframework:spock-core:1.0-groovy-2.4"
...
}
Javaslangを使う
build.gradle
dependencits {
...
compile "com.javaslang:javaslang:2.0.0-RC4"
...
}