Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle not using custom repository during gradle init #1097

Open
semih-toprak opened this issue Apr 29, 2022 · 2 comments
Open

Gradle not using custom repository during gradle init #1097

semih-toprak opened this issue Apr 29, 2022 · 2 comments

Comments

@semih-toprak
Copy link

I am trying to migrate my project from maven, but I can not access the custom company repository. Gradle connects to the central repository by default, and disregards both my maven settings.xml and init.gradle. The issue is the same as gradle/gradle#19884 but I am using a windows machine.

Expected Behavior

Gradle should use the repository settings from init.gradle.

Current Behavior

Gradle ignores the settings and tries to access https://repo.maven.apache.org/maven2 instead and gets blocked by corporate proxy. Same settings work fine while running any other gradle command, such as build.

Context

I can not convert a maven project to gradle while behind a corporate proxy that blocks maven repos.

Steps to Reproduce (for bugs)

1- Be behind a proxy that blocks maven repos.
2- Have a maven project
3- Open maven project folder and run gradle init with init.gradle config.

Your Environment

init.gradle file:

    allprojects {

        repositories {

            mavenLocal()

	    maven { url "custom-repo" }

	    maven { url "custom-repo" }

	    maven { url "custom-repo" }
    }
}

Settings xml:

<mirrors>
	<mirror>
		<mirrorOf>*</mirrorOf>
		<name>remote-repos</name>
		<url>custom-repo</url>
		<id>remote-repos</id>
	</mirror>
<!--  This was added in case * mirror did not work, but changed nothing. -->
	<mirror>
		<mirrorOf>central</mirrorOf>
		<name>apache-repo</name>
		<url>custom-repo</url>
		<id>apache-repo</id>
	</mirror>
</mirrors>
<!--  This was added in case mirrors did not work, but changed nothing.  -->
<repositories>
			<repository>
				<snapshots>
					<enabled>false</enabled>
				</snapshots>
				<id>central</id>
				<name>libs-release</name>
				<url>custom-repo</url>
			</repository>
			<repository>
				<snapshots />
				<id>snapshots</id>
				<name>libs-snapshot</name>
				<url>custom-repo</url>
			</repository>
		</repositories>
  • Build scan URL:
    I ran gradle init --scan and got the following error:

    FAILURE: Build failed with an exception.

    • Where:
      Auto-applied by using --scan

    • What went wrong:
      Plugin [id: 'com.gradle.enterprise', version: '3.8.1', artifact: 'com.gradle:gradle-enterprise-gradle-plugin:3.8.1'] 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.gradle:gradle-enterprise-gradle-plugin:3.8.1')
      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.

This is probably because it did not use my repo settings and got blocked by proxy.

@motoroler
Copy link

Hi! any update on this issue? I experience the same problem - try to transform maven project to gradle one, but it fails because my laptop behind firewall and it can't reach private repos

@madorb
Copy link

madorb commented Dec 7, 2022

this is the wrong project. gradle/gradle#20596

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants