Pom.xml error while creating new plugin

Hi,
I’m creating a new plugin using HelloWorld plugin as base. I’m using JDK 11, Eclipse IDE and. Maven 3.8.6.

However, I get 2 errors in pom.xml when right click the project > Maven > Update Project.

  1. Couldn’t download artifact: (org.jenkins-ci.tools:maven-hpi-plugin:3.28:validate:default-validate:validate)
  2. Error preparing the manifest: Failed to open artifact org.jenkins-ci.main:jenkins-core:jar:2.332.4:provided at C:\Users\KAGU.m2\repository\org\jenkins-ci\main\jenkins-core\2.332.4\jenkins-core-2.332.4.jar: org.apache.maven.project.ProjectBuildingException: Error resolving project artifact: org.jenkins-ci.main:jenkins-core:pom:2.332.4 was not found in Central Repository: during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced for project org.jenkins-ci.main:jenkins-core:jar:2.332.4 (org.jenkins-ci.tools:maven-hpi-plugin:3.28:test-hpl:default-test-hpl:test-compile)

Thanks!

can you share your pom.xml? It shouldn’t be trying to download jenkins from maven central.

Please find my pom.xml below.

<?xml version="1.0" encoding="UTF-8"?> 4.0.0 org.jenkins-ci.plugins plugin 4.41 io.jenkins.plugins install-is-package ${revision}${changelist} hpi TODO Plugin
<properties>
    <revision>1.0</revision>
    <changelist>-SNAPSHOT</changelist>

    <!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
    <jenkins.version>2.332.4</jenkins.version>
    <maven.compiler.release>11</maven.compiler.release>
</properties>

<dependencyManagement>
    <dependencies>
        <dependency>
            <!-- Pick up common dependencies for the selected LTS line: https://github.com/jenkinsci/bom#usage -->
            <groupId>io.jenkins.tools.bom</groupId>
            <artifactId>bom-2.332.x</artifactId>
            <version>1451.v15f1fdb_772a_f</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.jenkins-ci.tools/maven-hpi-plugin -->
		<dependency>
		    <groupId>org.jenkins-ci.tools</groupId>
		    <artifactId>maven-hpi-plugin</artifactId>
		    <version>2.1</version>
		</dependency>
    </dependencies>
</dependencyManagement>
<dependencies>
    <dependency>
        <groupId>org.jenkins-ci.plugins</groupId>
        <artifactId>structs</artifactId>
    </dependency>
    <dependency>
        <groupId>org.jenkins-ci.plugins.workflow</groupId>
        <artifactId>workflow-cps</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jenkins-ci.plugins.workflow</groupId>
        <artifactId>workflow-job</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jenkins-ci.plugins.workflow</groupId>
        <artifactId>workflow-basic-steps</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jenkins-ci.plugins.workflow</groupId>
        <artifactId>workflow-durable-task-step</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>repo.jenkins-ci.org</id>
        <url>https://repo.jenkins-ci.org/public/</url>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>repo.jenkins-ci.org</id>
        <url>https://repo.jenkins-ci.org/public/</url>
    </pluginRepository>
</pluginRepositories>
<build>
	<pluginManagement>
		<plugins>
			<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
			<plugin>
				<groupId>org.eclipse.m2e</groupId>
				<artifactId>lifecycle-mapping</artifactId>
				<version>1.0.0</version>
				<configuration>
					<lifecycleMappingMetadata>
						<pluginExecutions>
							<pluginExecution>
								<pluginExecutionFilter>
									<groupId>
										org.apache.maven.plugins
									</groupId>
									<artifactId>
										maven-antrun-plugin
									</artifactId>
									<versionRange>
										[3.1.0,)
									</versionRange>
									<goals>
										<goal>run</goal>
									</goals>
								</pluginExecutionFilter>
								<action>
									<ignore></ignore>
								</action>
							</pluginExecution>
						</pluginExecutions>
					</lifecycleMappingMetadata>
				</configuration>
			</plugin>
		</plugins>
	</pluginManagement>
</build>

Nothing looks wrong to me, but i’m no expert

Any idea why it can’t download that? does it say?

We’ve found some cases where a plugin was not configured to use the Jenkins artifact repository to download Jenkins artifacts. Some notes on that experience are included in the “Maven configuration” section of the “Contributing to Open Source” document. It may be worth comparing your ~/.m2/settings.xml with the sample file in that document. Please be sure to share what you learn with us.