码头 - 所有源罐(9.3)

时间:2016-09-16 11:38:48

标签: jetty embedded-jetty jetty-9

从Jetty 9.2.x迁移到9.3.x我再也找不到用于9.3.x的jetty-all-9.2.9.v20150224-sources.jar(https://repo1.maven.org/maven2/org/eclipse/jetty/aggregate/jetty-all/9.2.19.v20160908/

有没有办法为9.3.x检索这样的JAR?

THX。

1 个答案:

答案 0 :(得分:1)

首先,请参阅有关jetty-all的先前答案。

知道jetty文档中的命令行示例jetty-all-*.jar

如果您在项目或构建中使用jetty-all-*.jar的任何变体,那么您使用的方法不正确。

如果您在构建中使用jetty-all <dependency>,那么您的构建当前正在使用来自pom声明的坐标的各个下游依赖项。每个依赖项都有自己的sources分类附加工件(以及javadoc已分类),供您下载和访问源代码。

示例Maven项目pom

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.test</groupId>
    <artifactId>jetty-all-demo</artifactId>
    <version>1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>org.eclipse.jetty.aggregate</groupId>
            <artifactId>jetty-all</artifactId>
            <version>9.3.11.v20160721</version>
            <type>pom</type>
        </dependency>
    </dependencies>
</project>

这将生成以下依赖项列表

$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building jetty-all-demo 1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ jetty-all-demo ---
[INFO] com.test:jetty-all-demo:jar:1-SNAPSHOT
[INFO] \- org.eclipse.jetty.aggregate:jetty-all:pom:9.3.11.v20160721:compile
[INFO]    +- org.eclipse.jetty:jetty-client:jar:9.3.11.v20160721:compile
[INFO]    |  +- org.eclipse.jetty:jetty-http:jar:9.3.11.v20160721:compile
[INFO]    |  \- org.eclipse.jetty:jetty-io:jar:9.3.11.v20160721:compile
[INFO]    +- org.eclipse.jetty:jetty-deploy:jar:9.3.11.v20160721:compile
[INFO]    |  +- org.eclipse.jetty:jetty-webapp:jar:9.3.11.v20160721:compile
[INFO]    |  |  \- org.eclipse.jetty:jetty-servlet:jar:9.3.11.v20160721:compile
[INFO]    |  \- org.eclipse.jetty:jetty-xml:jar:9.3.11.v20160721:compile
[INFO]    +- org.eclipse.jetty:jetty-jmx:jar:9.3.11.v20160721:compile
[INFO]    +- org.eclipse.jetty:jetty-plus:jar:9.3.11.v20160721:compile
[INFO]    +- org.eclipse.jetty:jetty-annotations:jar:9.3.11.v20160721:compile
[INFO]    |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO]    |  +- org.ow2.asm:asm:jar:5.0.1:compile
[INFO]    |  \- org.ow2.asm:asm-commons:jar:5.0.1:compile
[INFO]    |     \- org.ow2.asm:asm-tree:jar:5.0.1:compile
[INFO]    +- org.eclipse.jetty:jetty-util:jar:9.3.11.v20160721:compile
[INFO]    +- org.eclipse.jetty:jetty-jaspi:jar:9.3.11.v20160721:compile
[INFO]    |  +- org.eclipse.jetty:jetty-security:jar:9.3.11.v20160721:compile
[INFO]    |  \- org.eclipse.jetty.orbit:javax.security.auth.message:jar:1.0.0.v201108011116:compile
[INFO]    +- org.eclipse.jetty:jetty-jndi:jar:9.3.11.v20160721:compile
[INFO]    +- org.eclipse.jetty:jetty-rewrite:jar:9.3.11.v20160721:compile
[INFO]    |  \- org.eclipse.jetty:jetty-server:jar:9.3.11.v20160721:compile
[INFO]    +- org.eclipse.jetty:jetty-servlets:jar:9.3.11.v20160721:compile
[INFO]    |  \- org.eclipse.jetty:jetty-continuation:jar:9.3.11.v20160721:compile
[INFO]    +- org.eclipse.jetty:jetty-quickstart:jar:9.3.11.v20160721:compile
[INFO]    |  \- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO]    +- org.eclipse.jetty.websocket:websocket-servlet:jar:9.3.11.v20160721:compile
[INFO]    |  \- org.eclipse.jetty.websocket:websocket-api:jar:9.3.11.v20160721:compile
[INFO]    +- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.3.11.v20160721:compile
[INFO]    |  +- org.eclipse.jetty.websocket:javax-websocket-client-impl:jar:9.3.11.v20160721:compile
[INFO]    |  \- org.eclipse.jetty.websocket:websocket-server:jar:9.3.11.v20160721:compile
[INFO]    +- org.eclipse.jetty.websocket:websocket-client:jar:9.3.11.v20160721:compile
[INFO]    |  \- org.eclipse.jetty.websocket:websocket-common:jar:9.3.11.v20160721:compile
[INFO]    +- org.eclipse.jetty:jetty-alpn-client:jar:9.3.11.v20160721:compile
[INFO]    +- org.eclipse.jetty.http2:http2-server:jar:9.3.11.v20160721:compile
[INFO]    |  \- org.eclipse.jetty.http2:http2-common:jar:9.3.11.v20160721:compile
[INFO]    |     \- org.eclipse.jetty.http2:http2-hpack:jar:9.3.11.v20160721:compile
[INFO]    +- org.eclipse.jetty.http2:http2-client:jar:9.3.11.v20160721:compile
[INFO]    +- javax.websocket:javax.websocket-api:jar:1.0:compile
[INFO]    +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO]    +- org.eclipse.jetty.orbit:javax.mail.glassfish:jar:1.4.1.v201005082020:compile
[INFO]    |  \- org.eclipse.jetty.orbit:javax.activation:jar:1.1.0.v201105071233:compile
[INFO]    \- org.slf4j:slf4j-api:jar:1.6.6:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.164 s
[INFO] Finished at: 2016-09-16T05:41:17-07:00
[INFO] Final Memory: 15M/485M
[INFO] ------------------------------------------------------------------------

这些依赖项中的每一个都有自己的sources jar。

我们测试了NetBeans,Eclipse和IntelliJ,他们都可以从全球中央存储库系统访问/下载这些sources罐子。这三个IDE中的每一个也可以使用来自任何流行构建系统的jetty-all(maven,gradle,ant + ivy,buildr,grape,grails,sbt等)

Maven和Gradle甚至可以使用工具来为您下载这些依赖项和/或源代码库。

将默认工件(通常是jar)下载到target / dependency /

$ mvn dependency:copy-dependencies

将源工件下载到target / dependency /

$ mvn dependency:copy-dependencies -Dclassifier=sources