0

Colleagues, i have a POM which create fat jar:

<properties>
        <java.version>1.8</java.version>
        <jdk.version>1.8</jdk.version>
        <spring.version>4.2.2.RELEASE</spring.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>



    <dependencies>


        <!-- Spring framework -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>4.2.3.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>4.2.3.RELEASE</version>
        </dependency>


        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.1</version>
        </dependency>



        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.11.0</version>
        </dependency>



    </dependencies>

    <build>


        <plugins>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>${jdk.version}</source>
                    <target>${jdk.version}</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19</version>
                    <executions>
                    <execution>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>


                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit47</artifactId>
                        <version>2.19</version>
                    </dependency>
                </dependencies>

                <configuration>
                    <includes>
                        <include>AdapterAppTest.java</include>
                    </includes>
                </configuration>
            </plugin>



            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                <!-- TODO исключить ряд библиотек  -->
                <appendAssemblyId>false</appendAssemblyId>
                    <archive>
                        <manifest>
                            <mainClass>com.comp.adapter</mainClass>
                        </manifest>
                    </archive>
                     <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs> 
                </configuration>
            </plugin>



        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
             <executions>
                <execution>
                    <id>attach-javadocs</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>javadoc</goal>
                    </goals>
                    <configuration>
                        <excludePackageNames>com.comp.entities</excludePackageNames>
                        <additionalparam>-Xdoclint:none</additionalparam> 
                        <reportOutputDirectory>${project.build.directory}/classes/</reportOutputDirectory>
                    </configuration>
                </execution>
            </executions> 
        </plugin>

        </plugins>
    </build>

As a result i have fat jar and javadoс description in the folder \target\classes\apidocs. After that i add this fat jar into new project (Add External Jar), but i don't see method description when use methods. Why and what i did wrong?

update

Ide eclipse

UPDATE 2 There are not *.java files in jar.

Shervin Asgari
  • 23,901
  • 30
  • 103
  • 143
May12
  • 2,420
  • 12
  • 63
  • 99
  • Either you have to include the sources, or you need to publish your sources to your maven repository (ie: Nexus) – Shervin Asgari Dec 08 '15 at 07:37
  • Shervin, thank you for attention to my question. First of all, I want to see a description of methods when calling them from the created fat jar file. If I understand coorectly to do this i need to add *.java files in the generated fat file. Am i wrong? Of course when i distribute fat jat into nexus it will be good if other developers can see javadoc comments. – May12 Dec 08 '15 at 07:49
  • 1
    Normally you don't do that. You have one jar with your classes, then one jar with sources and javadoc. Then its up to your users if they want to download the source and javadoc. Have a look here: https://maven.apache.org/plugin-developers/cookbook/attach-source-javadoc-artifacts.html – Shervin Asgari Dec 08 '15 at 08:50
  • IntelliJ or Eclipse will then automatically download the sources and javadoc onces if your users want to see the source, or you can do it manually with `mvn dependency:sources` – Shervin Asgari Dec 08 '15 at 08:53

0 Answers0