java - 将build.gradle移植到pom.xml InstantiationError:org.eclipse.jetty.util.SocketAddressResolver

标签 java maven gradle jetty

新增中

<dependency>
  <groupId>org.eclipse.jetty</groupId>
  <artifactId>jetty-util</artifactId>
  <version>9.2.3.v20140905</version>
</dependency>
<dependency>
  <groupId>org.eclipse.jetty</groupId>
  <artifactId>jetty-io</artifactId>
  <version>9.2.3.v20140905</version>
</dependency>
<dependency>
  <groupId>org.eclipse.jetty</groupId>
  <artifactId>jetty-http</artifactId>
  <version>9.2.3.v20140905</version>
</dependency>

似乎已解决了问题。我不知道为什么,因为那些依赖项不在build.gradle文件中。

我将保留这个问题,以便有人可以解释原因。

我正在尝试将build.gradle文件移植到pom.xml并在mvn clean verify中运行Failed to instantiate [org.eclipse.jetty.client.HttpClient]: Factory method 'httpClient' threw exception; nested exception is java.lang.InstantiationError: org.eclipse.jetty.util.SocketAddressResolver结果

我尝试合并Spring BOM时对pom.xml进行了一些更改,但是即使我从gradle生成的pom文件(由gradle maven插件生成)中获取依赖关系,我仍然会遇到相同的错误。
mvn dependency:tree的输出:
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building api 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ api ---
[INFO] ecorp.api:api:jar:1.0-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.4.1.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.4.1.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.4.1.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.4.1.RELEASE:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-starter-logging:jar:1.4.1.RELEASE:compile
[INFO] |  |     +- org.slf4j:jul-to-slf4j:jar:1.7.21:compile
[INFO] |  |     \- org.slf4j:log4j-over-slf4j:jar:1.7.21:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.4.1.RELEASE:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.5:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.5:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.5:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.8.3:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:1.4.1.RELEASE:compile
[INFO] |  \- org.springframework.boot:spring-boot-actuator:jar:1.4.1.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-configuration-processor:jar:1.4.1.RELEASE:compile
[INFO] |  +- org.json:json:jar:20140107:compile
[INFO] |  \- org.springframework:spring-core:jar:4.3.3.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:1.4.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:4.3.3.RELEASE:compile
[INFO] |  +- org.springframework.security:spring-security-config:jar:4.1.3.RELEASE:compile
[INFO] |  |  \- org.springframework.security:spring-security-core:jar:4.1.3.RELEASE:compile
[INFO] |  \- org.springframework.security:spring-security-web:jar:4.1.3.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:4.3.3.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:4.3.3.RELEASE:compile
[INFO] |  \- org.springframework:spring-context:jar:4.3.3.RELEASE:compile
[INFO] +- javax.mail:mail:jar:1.4.7:compile
[INFO] |  \- javax.activation:activation:jar:1.1.1:compile
[INFO] +- commons-net:commons-net:jar:3.4:compile
[INFO] +- com.google.guava:guava:jar:17.0:compile
[INFO] +- org.eclipse.jetty:jetty-client:jar:9.2.3.v20140905:compile
[INFO] |  +- org.eclipse.jetty:jetty-http:jar:9.3.11.v20160721:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-util:jar:9.3.11.v20160721:compile
[INFO] |  \- org.eclipse.jetty:jetty-io:jar:9.3.11.v20160721:compile
[INFO] +- org.yaml:snakeyaml:jar:1.13:compile
[INFO] +- org.projectlombok:lombok:jar:1.16.10:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.1.7:compile
[INFO] |  \- ch.qos.logback:logback-core:jar:1.1.7:compile
[INFO] +- ch.qos.logback:logback-access:jar:1.1.7:compile
[INFO] +- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
[INFO] |  +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] |  \- com.fasterxml:classmate:jar:1.3.1:compile
[INFO] +- org.testng:testng:jar:6.9.10:compile
[INFO] |  +- com.beust:jcommander:jar:1.48:compile
[INFO] |  \- org.beanshell:bsh:jar:2.0b4:compile
[INFO] +- org.springframework:spring-test:jar:4.3.3.RELEASE:test
[INFO] +- org.assertj:assertj-core:jar:2.5.0:test
[INFO] +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] |  \- org.objenesis:objenesis:jar:2.4:test
[INFO] +- com.google.code.gson:gson:jar:2.7:test
[INFO] +- com.icegreen:greenmail:jar:1.3.1b:test
[INFO] +- com.github.tomakehurst:wiremock:jar:1.58:test
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.5.2:test
[INFO] |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.5:test
[INFO] |  |  \- commons-codec:commons-codec:jar:1.10:test
[INFO] |  +- com.fasterxml.jackson.core:jackson-core:jar:2.8.3:compile
[INFO] |  +- xmlunit:xmlunit:jar:1.6:test
[INFO] |  +- org.mortbay.jetty:jetty:jar:6.1.26:test
[INFO] |  |  +- org.mortbay.jetty:jetty-util:jar:6.1.26:test
[INFO] |  |  \- org.mortbay.jetty:servlet-api:jar:2.5-20081211:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.3.0:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO] |  |  \- net.minidev:json-smart:jar:2.2.1:test
[INFO] |  |     \- net.minidev:accessors-smart:jar:1.1:test
[INFO] |  |        \- org.ow2.asm:asm:jar:5.0.3:test
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.3:compile
[INFO] |  \- net.sf.jopt-simple:jopt-simple:jar:5.0.2:test
[INFO] \- org.springframework.boot:spring-boot-starter-test:jar:1.4.1.RELEASE:test
[INFO]    +- org.springframework.boot:spring-boot-test:jar:1.4.1.RELEASE:test
[INFO]    +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.4.1.RELEASE:test
[INFO]    +- junit:junit:jar:4.12:test
[INFO]    \- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.645 s
[INFO] Finished at: 2016-12-28T12:30:30-05:00
[INFO] Final Memory: 20M/243M
[INFO] ------------------------------------------------------------------------

我的pom.xml
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>ecorp.api</groupId>
  <artifactId>api</artifactId>
  <name>api</name>
  <url>http://maven.apache.org</url>
  <packaging>jar</packaging>
  <!-- overwritten by Bamboo -->
  <version>1.0-SNAPSHOT</version>

  <parent>
    <groupId>ecorp</groupId>
    <artifactId>com.ecorp.master-pom</artifactId>
    <version>4.1.1</version>
  </parent>

  <properties>
    <jdkSourceVersion>1.8</jdkSourceVersion>
    <sonar.jacoco.reportPath>${project.basedir}/target/jacoco-ut.exec</sonar.jacoco.reportPath>
    <sonar.jacoco.itReportPath>${project.basedir}/target/jacoco-it.exec</sonar.jacoco.itReportPath>
    <sonar.exclusions></sonar.exclusions>

    <suite.type>serial</suite.type>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.spring.platform</groupId>
        <artifactId>platform-bom</artifactId>
        <version>Athens-RELEASE</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>

    <!--************************ Spring Dependencies ************************ -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-configuration-processor</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context-support</artifactId>
    </dependency>

    <!--************************ Java Dependencies ************************ -->
    <dependency>
      <groupId>javax.mail</groupId>
      <artifactId>mail</artifactId>
      <version>1.4.7</version>
    </dependency>

    <!--************************ Misc. Dependencies ************************ -->
    <dependency>
      <groupId>commons-net</groupId>
      <artifactId>commons-net</artifactId>
      <version>3.4</version>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-client</artifactId>
      <version>9.2.3.v20140905</version>
    </dependency>
    <dependency>
      <groupId>org.yaml</groupId>
      <artifactId>snakeyaml</artifactId>
      <version>1.13</version>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-access</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-validator</artifactId>
    </dependency>

    <!--************************ Test Dependencies ************************ -->
    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.icegreen</groupId>
      <artifactId>greenmail</artifactId>
      <version>1.3.1b</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.github.tomakehurst</groupId>
      <artifactId>wiremock</artifactId>
      <version>1.58</version>
      <scope>test</scope>
    </dependency>

    <!--************************ Spring Test Dependencies ************************ -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <!--************************ Build and Plugins ************************ -->
  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>1.3.8.RELEASE</version>
        <configuration>
          <addResources>true</addResources>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19.1</version>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>src/test/resources/suites/all-tests-${suite.type}.xml</suiteXmlFile>
          </suiteXmlFiles>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.17</version>
        <executions>
          <execution>
            <!--override master pom-->
            <id>default-config</id>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
            <configuration>
              <suiteXmlFiles>
                <suiteXmlFile>src/test/resources/suites/cross-site-nav-tests-${suite.type}.xml</suiteXmlFile>
              </suiteXmlFiles>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>

    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>

    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>
  </build>
</project>

我的build.gradle
description = 'API'

group = 'ecorp.api'
version = getenv('version', 'unknown')

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'spring-boot'
apply plugin: 'checkstyle'
apply plugin: 'project-report'
apply plugin: 'sonar-runner'
apply plugin: 'eclipse'
apply plugin: 'jacoco'
apply plugin: 'war'

war {
    baseName = 'api'
}

compileJava.options.encoding = 'UTF-8'

ext.sourceCompatibility = JavaVersion.toVersion('1.8')
ext.targetCompatibility = JavaVersion.toVersion('1.8')

eclipse {
    classpath {
        downloadSources = true
        downloadJavadoc = true
    }
}

checkstyle {
    toolVersion = '7.2'
    configFile = rootProject.file('src/main/resources/checkstyle.xml')
    sourceSets = [sourceSets.main]
    showViolations = true
    ignoreFailures = true
}

bootRun {
    // Enable ./gradlew -Dspring.profiles.active=dev bootRun
    // https://github.com/spring-projects/spring-boot/issues/832
    systemProperties = System.properties
}

buildscript {
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.12.RELEASE")
    }
    repositories {
        maven { url "http://nexus/nexus/content/groups/public" }
    }
}

jacoco {
    toolVersion = "0.7.0.201403182114"
    reportsDir = file("$buildDir/jacoco/reports")
}

test {
    systemProperties = System.properties
    useTestNG()
    jacoco {
        append = false
        destinationFile = file("$buildDir/jacoco/test.exec")
    }
}

// Integration test setup from http://selimober.com/blog/2014/01/24/separate-unit-and-integration-tests-using-gradle/
sourceSets {
    integTest {
        java.srcDir file('src/it/java')
        resources.srcDir file('src/it/resources')
    }
}

task integTest(type: Test) {
    testClassesDir = sourceSets.integTest.output.classesDir
    classpath = sourceSets.integTest.runtimeClasspath
}

check.dependsOn integTest

dependencies {
    integTestCompile sourceSets.main.output
    integTestCompile configurations.testCompile
    integTestCompile sourceSets.test.output
    integTestRuntime configurations.testRuntime
}

integTest {
    systemProperties = System.properties
    useTestNG()
    jacoco {
        append = false
        destinationFile = file("$buildDir/jacoco/integTest.exec")
    }
}


task wrapper(type: Wrapper) {
    gradleVersion = '2.8'
    distributionUrl = 'http://nexus/nexus/content/repositories/Gradle/gradle/gradle/2.8/gradle-2.8-all.zip'
}

configurations { providedRuntime }

/*
 * Include 'provided' scoped dependency during compile time
 */
sourceSets.main.compileClasspath += configurations.providedRuntime

// Define versions used in 2+ places
def versions = [
        activation                  : "1.1.1",
        guava                       : "19.0",
        jackson                     : "2.4.2",
        tomcat                      : "8.0.14",
        logback                     : "1.1.2",
        slf4j                       : "1.7.15",
        snakeYaml                   : "1.13",
        spring                      : "4.2.4.RELEASE",
        springBoot                  : "1.3.2.RELEASE",
        springSecurity              : "3.2.9.RELEASE",
        hibernateValidator          : "5.1.1.Final",
        validation                  : "1.1.0.Final",
        hibernateValidatorAnnotation: "5.1.1.Final"
]

configurations.all {
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
    exclude group: 'commons-logging', module: 'commons-logging'
    exclude group: 'org.slf4j', module: 'slf4j-log4j12'
    exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
    exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
    resolutionStrategy {
        force "ch.qos.logback:logback-classic:${versions.logback}",
                "org.slf4j:slf4j-api:${versions.slf4j}",
                "org.slf4j:jcl-over-slf4j:1.7.6",
                "org.springframework:spring-aop:${versions.spring}",
                "org.springframework:spring-beans:${versions.spring}",
                "org.springframework:spring-context:${versions.spring}",
                "org.springframework:spring-context-support:${versions.spring}",
                "org.springframework:spring-core:${versions.spring}",
                "org.springframework:spring-expression:${versions.spring}",
                "org.springframework:spring-messaging:${versions.spring}",
                "org.springframework:spring-tx:${versions.spring}",
                "org.springframework:spring-web:${versions.spring}",
                "org.springframework:spring-webmvc:${versions.spring}",
                "org.springframework.security:spring-security-config:${versions.springSecurity}",
                "org.springframework.security:spring-security-web:${versions.springSecurity}",
                "org.springframework.ldap:spring-ldap-core:2.0.1.RELEASE",
                "javax.activation:activation:${versions.activation}",
                "org.yaml:snakeyaml:${versions.snakeYaml}",
                "org.apache.httpcomponents:httpclient:4.5",
                "joda-time:joda-time:2.9.2",
                "com.google.guava:guava:${versions.guava}",
                "com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}",
                "com.fasterxml.jackson.core:jackson-core:${versions.jackson}",
                "com.fasterxml.jackson.core:jackson-databind:${versions.jackson}",
                "commons-beanutils:commons-beanutils:1.7.0",
                "commons-collections:commons-collections:3.2.1",
                "javax.mail:mail:1.4.7",
                "javax.validation:validation-api:${versions.validation}",
                "org.hibernate:hibernate-validator:${versions.hibernateValidator}",
                "org.hibernate:hibernate-validator-annotation-processor:${versions.hibernateValidatorAnnotation}",
                "net.sf.jopt-simple:jopt-simple:4.7"
        failOnVersionConflict()
    }
}

dependencies {
    compile group: 'org.projectlombok', name: 'lombok', version: "1.14.4"
    compile group: 'org.yaml', name: 'snakeyaml', version: "${versions.snakeYaml}"

    compile group: 'org.slf4j', name: 'slf4j-api', version: "${versions.slf4j}"
    compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: "${versions.slf4j}"
    compile group: 'ch.qos.logback', name: 'logback-classic', version: "${versions.logback}"
    compile group: 'ch.qos.logback', name: 'logback-access', version: "${versions.logback}"
    compile(group: 'org.logback-extensions', name: 'logback-ext-spring', version: "0.1.1") {
        exclude(module: 'spring-context')
        exclude(module: 'spring-web')
        exclude(module: 'servlet-api')
    }
    compile group: 'com.google.guava', name: 'guava', version: "${versions.guava}"
    compile group: 'org.apache.commons', name: 'commons-lang3', version: "3.3.2"
    compile group: 'commons-net', name: 'commons-net', version: "3.4"
    compile group: 'org.springframework', name: 'spring-core', version: "${versions.spring}"
    compile group: 'org.springframework', name: 'spring-aop', version: "${versions.spring}"
    compile group: 'org.springframework', name: 'spring-beans', version: "${versions.spring}"
    compile group: 'org.springframework', name: 'spring-web', version: "${versions.spring}"
    compile group: 'org.springframework', name: 'spring-webmvc', version: "${versions.spring}"
    compile group: 'org.springframework', name: 'spring-tx', version: "${versions.spring}"
    compile group: 'org.springframework', name: 'spring-context', version: "${versions.spring}"

    compile group: 'org.springframework', name: 'spring-context-support', version: "${versions.spring}"
    compile group: 'javax.mail', name: 'mail', version: "1.4.7"
    compile group: 'javax.activation', name: 'activation', version: "${versions.activation}"

    compile group: 'org.springframework.plugin', name: 'spring-plugin-core', version: "0.8.0.RELEASE"
    compile group: 'org.springframework.boot', name: 'spring-boot', version: "${versions.springBoot}"
    compile group: 'org.springframework.boot', name: 'spring-boot-actuator', version: "${versions.springBoot}"
    compile group: 'org.springframework.boot', name: 'spring-boot-starter', version: "${versions.springBoot}"
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: "${versions.springBoot}"

    compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: "${versions.springBoot}"

    compile group: 'org.eclipse.jetty', name: 'jetty-client', version: "9.2.3.v20140905"

    compile "org.apache.tomcat.embed:tomcat-embed-core:${versions.tomcat}"
    compile "org.apache.tomcat.embed:tomcat-embed-logging-juli:${versions.tomcat}"

    compile group: 'javax.validation', name: 'validation-api', version: '${versions.validation}'
    compile group: 'org.hibernate', name: 'hibernate-validator', version: "${versions.hibernateValidator}"
    compile "org.hibernate:hibernate-validator-annotation-processor:${versions.hibernateValidatorAnnotation}"
    compile "javax.el:javax.el-api:2.2.4"
    compile "org.glassfish.web:javax.el:2.2.4"

    compile group: 'org.aspectj', name: 'aspectjweaver', version: '1.8.0'

    compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: "${versions.springBoot}"
    compile group: 'org.springframework.security', name: 'spring-security-core', version: "${versions.springSecurity}"
    compile group: 'org.springframework.security', name: 'spring-security-web', version: "${versions.springSecurity}"
    compile group: 'org.springframework.security', name: 'spring-security-config', version: "${versions.springSecurity}"

    testCompile group: 'org.testng', name: 'testng', version: "6.8.1"
    testCompile group: 'org.assertj', name: 'assertj-core', version: "3.3.0"
    testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: "1.3"
    testCompile group: 'org.mockito', name: 'mockito-core', version: "1.10.19"
    testCompile group: 'org.springframework', name: 'spring-test', version: "${versions.spring}"
    testCompile group: 'org.apache.httpcomponents', name: 'httpclient', version: "4.5"
    testCompile group: "com.icegreen", name: "greenmail", version: "1.3.1b"
    testCompile group: 'com.github.tomakehurst', name: 'wiremock', version: "1.58"
    testCompile group: 'com.google.code.gson', name: 'gson', version: "2.5"
}

def getenv(name, defaultVal = null) {
    return System.properties[name] ?: System.env[name] ?: defaultVal
}

最佳答案

请勿混用Jetty版本。

[INFO] +- org.eclipse.jetty:jetty-client:jar:9.2.3.v20140905:compile
[INFO] |  +- org.eclipse.jetty:jetty-http:jar:9.3.11.v20160721:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-util:jar:9.3.11.v20160721:compile
[INFO] |  \- org.eclipse.jetty:jetty-io:jar:9.3.11.v20160721:compile
...
[INFO] |  +- org.mortbay.jetty:jetty:jar:6.1.26:test
[INFO] |  |  +- org.mortbay.jetty:jetty-util:jar:6.1.26:test

始终使用相同的版本。

另外,Jetty 9.x是Servlet 3.1 ...
[INFO] |  |  \- org.mortbay.jetty:servlet-api:jar:2.5-20081211:test

那是无效的。

关于java - 将build.gradle移植到pom.xml InstantiationError:org.eclipse.jetty.util.SocketAddressResolver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41367023/

相关文章:

java - 在java中创建一个运行文件

java - 如何在 Tomcat 中运行 maven archetype 生成的 struts 1 项目?

java - "package jdk.jshell.spi does not exist"- 仅在一台电脑上出现错误

android - 为Android studio中的单元测试配置测试文件夹

scala - 用gradle编译scala项目:MissingRequirementError

java - Hibernate @Proxy(lazy = false) 注解有什么作用?

java - 当子类未实现所有构造函数时实例化基类

java - 更改列表项背景边框的颜色

maven - IntelliJ 中的构建模块实际上为 maven 模块做了什么

osgi - 使用 Gradle 创建具有依赖 Jas 的 Osgi Bundle