LoginSignup
1
3

More than 5 years have passed since last update.

Eclipseにソースコードをアタッチするビルド設定

Posted at

SpringBootにおいて、Spring Initializr(http://start.spring.io/) で設定を変更しながらいろいろなプロジェクトを作って試しています。
アノテーションのソースコードを見ようとして、F3を押してところ、ソースコードがないことが判明。
Spring Initializrでは、ソースコードをアタッチする設定を入れてくれない模様。残念ですが自分で追加すればいいだけ。

しかし、テンプレートを使って使いまわしていたので設定を覚えておらず毎回検索するのもどうかと思って、ここに備忘しておこうと思います。

基本的にはEclipseの設定では

  • downloadSources
  • downloadJavadocs

を扱います。downloadSourcesがソースコードをアタッチし、downloadJavadocsがJavaDocをアタッチする設定です。

Mavenの場合

pom.xml

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <configuration>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
        </plugins>
    </build>

上記の例は、SpringBootのプラグインの設定もしてあります。

pom.xmlのbuildのpluginとして、maven-eclipse-pluginを追加し、このプラグインに対して、設定すればよいことになります。

Gradleの場合

build.gradle
eclipse {
    classpath {
       downloadSources=true
       downloadJavadoc=true
    }
}

Gradleの場合、eclipse pluginのclasspath設定に設定すればいいのですが、JavaDocの設定は英語の複数形のsがないことに注意する必要があります。

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3