user2870934
user2870934

Reputation: 709

Gradle ignores internal nexus repository

I have very simple java project, and I'm using gradle to build it. And I have Linux RedHat server (without access to internet) but this server has access to internal nexus repository where all required dependencies present.

This is build.gradle file:

buildscript {
    ext {
        springBootVersion = '2.0.3.RELEASE'
    }
    repositories {
        maven { url "https://nexus.com.mysite/nexus/content/repositories/mirror/" }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

plugins {
    id 'com.github.jacobono.jaxb' version '1.3.5' // this is 14 line
}

repositories {
    maven { url "https://nexus.com.mysite/nexus/content/repositories/mirror/" }
}

subprojects {
    apply plugin: 'java'
    apply plugin: 'idea'
    apply plugin: 'eclipse'
    apply plugin: 'maven'
    apply plugin: 'io.spring.dependency-management'

    sourceCompatibility = 1.8

    dependencyManagement {
        imports {
            mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
        }
    }

    buildscript {
        repositories {
            maven { url "https://nexus.com.mysite/nexus/content/repositories/mirror/" }
        }
    }
    repositories {
        maven { url "https://nexus.com.mysite/nexus/content/repositories/mirror/" }
    }
}

allprojects {
    buildscript {
        repositories {
            maven { url "https://nexus.com.mysite/nexus/content/repositories/mirror/" }
        }
    }
}

Settings file settings.gradle:

include 'api'

project(":api").name = "api"

And this project has 1 submodule api filder. api build.gradle file:

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

apply plugin: 'com.github.jacobono.jaxb'

springBoot {
    buildInfo()
}

group = 'com.example'
version = '1.0.0'
sourceCompatibility = 1.8

repositories {
    maven { url "https://nexus.com.mysite/nexus/content/repositories/mirror/" }
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
}

springBoot {
    mainClassName = 'com.example.TestApplication'
}

On my linux server I have: - java 8 - gradle 4.5.1 - mvn 3.5.6

When I'm running gradle clean inside root folder of my project, after 5-10 mins I'm receiving error:

FAILURE: Build failed with an exception.

* Where:
Build file '/my-proj/build.gradle' line: 14

* What went wrong:
Plugin [id: 'com.github.jacobono.jaxb', version: '1.3.5'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.github.jacobono.jaxb:com.github.jacobono.jaxb.gradle.plugin:1.3.5')
  Searched in the following repositories:
    Gradle Central Plugin Repository

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 10m 3s

And for some reason in this error there is no information about my nexus repository...I assuming that it even haven't tried this repository. And the question is why...?

I would be very happy of any help...maybe I made mistake in build.gradle file somewhere...

p.s. on my local pc(I have access to internet and to this repository everything works file)

Upvotes: 1

Views: 2597

Answers (1)

miskender
miskender

Reputation: 7938

Plugins by default resolved from Gradle Plugin Portal. If you want to resolve them from different sources, You should add configuration to settings.gradle file.

Example:

pluginManagement {
    repositories {
        maven {
            url '../maven-repo'
        }
        gradlePluginPortal()
        ivy {
            url '../ivy-repo'
        }
    }
}

Check the docs for details.

Upvotes: 2

Related Questions