日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > java >内容正文

java

javadoc maven_创建Maven源代码和Javadoc工件

發(fā)布時(shí)間:2023/12/3 java 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 javadoc maven_创建Maven源代码和Javadoc工件 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

javadoc maven

許多人都知道Maven源代碼和Javadoc工件,但是不知道為什么要?jiǎng)?chuàng)建它們。 我絕對(duì)是在這個(gè)陣營(yíng)中–我可以理解為什么人們想要此信息,但是由于需要手動(dòng)導(dǎo)航Maven存儲(chǔ)庫(kù),因此獲取信息似乎相對(duì)效率較低。

然后我被線索棒擊中。

這些工件由IDE而非人員使用。 如果您使用的是maven依賴項(xiàng),那么IDE足夠聰明,可以知道如何查找這些工件。 當(dāng)您單步調(diào)試器中的代碼時(shí),將使用源工件-不再需要將源代碼顯式綁定到IDE中的庫(kù)。 javadoc工件用于編輯器中的自動(dòng)完成和上下文相關(guān)幫助。

這些都不是必需的-多年來(lái)我一直很高興使用'vi'-但是當(dāng)您大部分都知道自己需要什么但不確定細(xì)節(jié)時(shí),它肯定會(huì)提高您的生產(chǎn)率。

源工件

源工件最容易創(chuàng)建。 添加一個(gè)將作為標(biāo)準(zhǔn)構(gòu)建的一部分自動(dòng)運(yùn)行的插件,您已完成。 構(gòu)建花費(fèi)的時(shí)間稍長(zhǎng)一些,但是您只需要?jiǎng)?chuàng)建幾個(gè)目錄的歸檔文件就不必?fù)?dān)心了。

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><build><plugins><!-- create source jar --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-source-plugin</artifactId><version>2.1.1</version><executions><execution><id>attach-sources</id><phase>verify</phase><goals><!-- produce source artifact for project main sources --><goal>jar-no-fork</goal><!-- produce test source artifact for project test sources --><goal>test-jar-no-fork</goal></goals></execution></executions></plugin></plugins></build> </project>

Javadoc工件

Javadoc工件要復(fù)雜一些,因?yàn)槟赡芟M瑫r(shí)創(chuàng)建一個(gè)對(duì)人類友好的網(wǎng)站。 根據(jù)我的經(jīng)驗(yàn),最大的問(wèn)題是外部類是不透明的,因?yàn)閯?chuàng)建必需的鏈接花費(fèi)了很多精力。 Maven插件現(xiàn)在為我們解決了這個(gè)問(wèn)題!

構(gòu)建該工件需要花費(fèi)大量時(shí)間,因此您可能不想每次都這樣做。 有兩種方法-明確指定Maven目標(biāo)或?qū)⑵浣壎ǖ阶远x配置文件,例如'javadoc'。 以下配置使用自定義配置文件。

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><profiles><!-- create javadoc --><profile><id>javadoc</id><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-javadoc-plugin</artifactId><version>2.9.1</version><configuration><detectLinks /><includeDependencySources>true</includeDependencySources><dependencySourceIncludes><dependencySourceInclude>com.invariantproperties.project.student:*</dependencySourceInclude></dependencySourceIncludes><!-- heavily used dependencies --><links><link>http://docs.oracle.com/javase/7/docs/api/</link><link>http://docs.oracle.com/javaee/6/api</link><link>http://docs.spring.io/spring/docs/current/javadoc-api/</link><link>http://docs.spring.io/spring-data/commons/docs/1.6.2.RELEASE/api/</link><link>http://docs.spring.io/spring-data/jpa/docs/1.4.3.RELEASE/api/</link><link>http://docs.spring.io/spring-data/data-jpa/docs/1.4.3.RELEASE/api/</link><link>https://jersey.java.net/apidocs/1.17/jersey/</link><link>http://hamcrest.org/JavaHamcrest/javadoc/1.3/</link><link>http://eclipse.org/aspectj/doc/released/runtime-api/</link><link>http://eclipse.org/aspectj/doc/released/weaver-api</link><link>http://tapestry.apache.org/5.3.7/apidocs/</link></links></configuration><executions><execution><id>aggregate</id><!-- <phase>site</phase> --><phase>package</phase><goals><goal>aggregate</goal><goal>jar</goal></goals></execution></executions></plugin></plugins></build><reporting><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-javadoc-plugin</artifactId><version>2.9.1</version><configuration><!-- Default configuration for all reports --></configuration><reportSets><reportSet><id>non-aggregate</id><configuration><!-- Specific configuration for the non aggregate report --></configuration><reports><report>javadoc</report></reports></reportSet><reportSet><id>aggregate</id><configuration><!-- Specific configuration for the aggregate report --></configuration><reports><report>aggregate</report></reports></reportSet></reportSets></plugin></plugins></reporting></profile></profiles> </project>

包信息.java

最后,每個(gè)軟件包都應(yīng)該具有package-info.java文件。 這將替換舊的package-info.html文件,但由于它允許使用類注釋,因此是一個(gè)改進(jìn)。 (由于它是無(wú)效的類名,因此不會(huì)被編譯。)

我發(fā)現(xiàn)包含指向資源的鏈接非常有幫助,這些鏈接可以幫助我理解類的外觀。 例如,“學(xué)生”項(xiàng)目中的元數(shù)據(jù)包包含指向我的博客文章,我認(rèn)為有用的其他博客文章甚至適當(dāng)?shù)腛racle教程的鏈接。 在公司中,這些可能是指向Wiki頁(yè)面的鏈接。

/** * Classes that support JPA Criteria Queries for persistent entities.* * @see <a href="http://invariantproperties.com/2013/12/19/project-student-persistence-with-spring-data/">Project Student: Persistence with Spring Data</a>* @see <a href="http://invariantproperties.com/2013/12/29/project-student-jpa-criteria-queries/">Project Student: JPA Criteria Queries</a>* @see <a href="http://www.petrikainulainen.net/programming/spring-framework/spring-data-jpa-tutorial-part-four-jpa-criteria-queries/">Spring Data JPA Tutorial Part Four: JPA Criteria Queries</a> [www.petrikainulainen.net]* @see <a href="http://docs.oracle.com/javaee/6/tutorial/doc/gjitv.html">JEE Tutorial</a> * * @author Bear Giles <bgiles@coyotesong.com>*/ package com.invariantproperties.project.student.metamodel;

源代碼

  • 源代碼位于https://github.com/beargiles/project-student [github]和http://beargiles.github.io/project-student/ [github頁(yè)面]。

參考: Invariant Properties博客上的JCG合作伙伴 Bear Giles 創(chuàng)建Maven源代碼和Javadoc工件 。

翻譯自: https://www.javacodegeeks.com/2014/02/creating-maven-source-and-javadoc-artifacts.html

javadoc maven

總結(jié)

以上是生活随笔為你收集整理的javadoc maven_创建Maven源代码和Javadoc工件的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。