Coder Social home page Coder Social logo

archetypes's Introduction

Introduction

Maven archetypes to help you create new components involving Jenkins, such as plugins.

GitHub release

Usage

To see all currently released archetypes and pick one to instantiate:

mvn archetype:generate -Dfilter=io.jenkins.archetypes:

It is also possible to run this noninteractively:

mvn archetype:generate -B -DarchetypeGroupId=io.jenkins.archetypes -DarchetypeArtifactId=empty-plugin -DhostOnJenkinsGitHub=true -DarchetypeVersion=1.20 -DartifactId=somefeature

In olden times, people used mvn hpi:create or even a web-based tool to create new plugins. This has been deprecated in favor of the new archetypes, which cover more scenarios and require no special tooling.

The NetBeans IDE also offers a plugin for Jenkins development which offers a Jenkins plugin archetype via the File ยป New Project wizard.

If you have defined a mirror like this in your settings.xml you might not be able to use filter option as described above.

 <mirror>
   <id>repo.jenkins-ci.org-all</id>
   <url>https://repo.jenkins-ci.org/public</url>
   <mirrorOf>*,!central</mirrorOf>
</mirror>

Changes

See GitHub Releases for changes.

For older versions, see the archive.

Development

To create a new archetype, file a pull request creating a new module, following the examples currently here. Important pieces:

  • pom.xml must have <packaging>maven-archetype</packaging>
  • should also have a <description>
  • src/main/resources/META-INF/maven/archetype-metadata.xml defines files and directories to be copied & processed
  • src/main/resources/archetype-resources/: the template for the new component (remember a sample .gitignore)
  • src/test/resources/projects/testInstall/{goal.txt,archetype.properties}: defines an integration test, proving that the archetype can not just be instantiated, but builds successfully thereafter
  • if it should have our standard templates for .gitignore, README.md, etc., then copy the maven-resources-plugin config in empty-plugin

Archetypes are expected to use technologies hosted in @jenkinsci (or a few other places pulled in by Jenkins core, such as @stapler). Other archetypes can be developed in a profile but will not be published. Releasing:

mvn -B release:{prepare,perform}

In addition to needing write permission to this repository, you must have been preauthorized to deploy to the io/jenkins/archetypes/ sector of OSSRH.

Artifacts will appear on Maven Central after a few minutes. But as noted in OSSRH-34275, the catalog only gets regenerated weekly; to check it:

curl -s http://repo1.maven.org/maven2/archetype-catalog.xml | xmlstarlet sel -R -I -t -c '//archetype[groupId="io.jenkins.archetypes"]'

If testing their appearance, be sure to use a clean environment:

docker run -ti --rm --name mvn --entrypoint /bin/bash maven:3.8.3-jdk-8

archetypes's People

Contributors

basil avatar christ66 avatar daftano avatar daniel-beck avatar danielfbm avatar dduportal avatar dependabot-preview[bot] avatar dependabot[bot] avatar dwnusbaum avatar imod avatar jglick avatar jtnord avatar markewaite avatar notmyfault avatar olamy avatar olblak avatar oleg-nenashev avatar ozangunalp avatar renovate[bot] avatar rrjjvv avatar rsandell avatar runzexia avatar strangelookingnerd avatar timja avatar vlatombe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

archetypes's Issues

Enable Spotless

What feature do you want to see added?

While #613 updated the parent POM, it did not enable jenkinsci/plugin-pom#733. As archetypes are for new development, the justification for disabling by default does not seem to apply, so these projects should be opted in by default to formatting.

Upstream changes

No response

Add actual plugin package

Many plugin developers started putting their classes directly in io.jenkins.plugins.

Even if the archetype is not flexible enough to create a real package based on the plugin name, a placeholder io.jenkins.plugins.TODO package should be added.

Sample plugin should have fewer localizations

What feature do you want to see added?

The sample plugin is currently localized in German, Spanish, Italian, Swedish, Turkish, Brazilian Portuguese, and Traditional Chinese (plus the default English).

Since these are sample texts, their only use is to demonstrate how to localize a plugin. Having more translations means there's only more files to delete (or forget to) when using the sample plugin as the basis for a real plugin.

I suggest that there be fewer localizations. Perhaps Spanish as a partly unicode-escaped language, and Chinese as a fully escaped one? This selection also covers the most native speakers.

Upstream changes

No response

verify hello world plugin error

Jenkins and plugins versions report

Environment
Paste the output here

What Operating System are you using (both controller, and any agents involved in the problem)?

window10
maven3.4.0

Reproduction steps

  1. mvn archetype:generate -B -DarchetypeGroupId=io.jenkins.archetypes -DarchetypeArtifactId=empty-plugin -DhostOnJenkinsGitHub=true -DarchetypeVersion=1.20 -DartifactId=somefeature
  2. cd somefeature
  3. mvn verify

Expected Results

success

Actual Results

[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project io.jenkins.plugins:somefeature:1.0-SNAPSHOT (E:\jenkins-my-plug\somefeature\pom.xml) has 2 errors
[ERROR] Malformed POM E:\jenkins-my-plug\somefeature\pom.xml: Unknown attribute 'child.scm.url.inherit.append.path' for tag 'scm' (position: START_TAG seen ...rit.append.path="false" child.scm.url.inherit.append.path="false">... @22:157) @ E:\jenkins-my-plug\somefeature\pom.xml, line 22, column 157 -> [Help 2]
[ERROR] Unknown packaging: hpi @ io.jenkins.plugins:somefeature1:${revision}${changelist}, E:\jenkins-my-plug\somefeature\pom.xml, line 13, column 14
[ERROR]

Anything else?

No response

Are you interested in contributing a fix?

No response

Archetypes generate incomplete/incorrect repos with `-DhostOnJenkinsGitHub=false`

Jenkins and plugins versions report

Environment

N/A

What Operating System are you using (both controller, and any agents involved in the problem)?

Linux (controller/agents N/A)

Reproduction steps

Generate an archetype with -DhostOnJenkinsGitHub=false:

$ mvn -V archetype:generate -DarchetypeGroupId=io.jenkins.archetypes -DarchetypeArtifactId=empty-plugin -DhostOnJenkinsGitHub=false -DgroupId=mygroup -Dpackage=mypackage -DartifactId=myartifact -DinteractiveMode=false
Apache Maven 3.9.2 (c9616018c7a021c1c39be70fb2843d6f5f9b8a1c)
Maven home: /opt/maven
Java version: 17.0.10, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.5.0-25-generic", arch: "amd64", family: "unix"
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] >>> archetype:3.2.1:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO] 
[INFO] <<< archetype:3.2.1:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO] 
[INFO] 
[INFO] --- archetype:3.2.1:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Batch mode
[INFO] Archetype [io.jenkins.archetypes:empty-plugin:1.24] found in catalog remote
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: empty-plugin:1.24
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: mygroup
[INFO] Parameter: artifactId, Value: myartifact
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: mypackage
[INFO] Parameter: packageInPathFormat, Value: mypackage
[INFO] Parameter: package, Value: mypackage
[INFO] Parameter: hostOnJenkinsGitHub, Value: false
[INFO] Parameter: groupId, Value: mygroup
[INFO] Parameter: artifactId, Value: myartifact
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[WARNING] Don't override file /tmp/myartifact/
[INFO] Executing META-INF/archetype-post-generate.groovy post-generation script
Not hosting on Jenkins Github organisation, removing files specific to jenkinsci
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.785 s
[INFO] Finished at: 2024-03-14T21:45:02-06:00
[INFO] ------------------------------------------------------------------------
[WARNING] 
[WARNING] Plugin validation issues were detected in 2 plugin(s)
[WARNING] 
[WARNING]  * org.apache.maven.plugins:maven-site-plugin:3.12.1
[WARNING]  * org.apache.maven.plugins:maven-archetype-plugin:3.2.1
[WARNING] 
[WARNING] For more or less details, use 'maven.plugin.validation' property with one of the values (case insensitive): [BRIEF, DEFAULT, VERBOSE]
[WARNING] 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate (default-cli) on project standalone-pom: could not access constructor: private java.io.File(java.lang.String,java.io.File) with arguments: [Jenkinsfile, /tmp/myartifact] reason: java.lang.IllegalAccessException: class org.codehaus.groovy.reflection.CachedConstructor cannot access a member of class java.io.File (in module java.base) with modifiers "private" -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Expected Results

I expected the generation to:

  1. complete with no errors
  2. provide a valid .gitignore

After looking at the source to see what that flag is supposed to do, I'd also expect no LICENSE.md, Jenkinsfile, or .github/.

Actual Results

  1. resulted in an error (shown above)
  2. provided a file named gitignore (no leading dot); this is what got my attention
  3. files/directories that shouldn't be present:
    $ ls -a
    .  ..  .github  gitignore  Jenkinsfile  LICENSE.md  .mvn  pom.xml  README.md  src

Anything else?

The root cause is using a private constructor:

new File(it, projectPath.toFile()).delete()

The 'pre-generate' contents still get written to disk (including a pom without github info), but the first attempt at deletion causes the rest of the script to prematurely fail.

My assumption is that this originally implemented using Java 8.

Are you interested in contributing a fix?

The fix is trivial. Assuming a fix without tests might be rejected, I started down down that path, which led to more (unrelated) issues. I'll submit a PR shortly and you can decide what to do when you see it.

Suggest Java 21 in recommended `Jenkinsfile`

Since Java 11 is likely to be EOL in October 2024, it might be a good time to start recommending Java 21 and Java 17 in the default test matrix rather than Java 17 and Java 11.

Reduce Dependabot spam

The average low activity plugin gets way too much Dependabot spam via this default configuration. See e.g. https://github.com/jenkinsci/solarized-theme-plugin/pulls?q=is%3Apr

The frequency of at least parent POM and BOM updates needs to be dialed waaaayyy back by default.

Per https://docs.github.com/en/code-security/supply-chain-security/configuration-options-for-dependency-updates#scheduleinterval it looks like the lowest possible value is monthly which still seems like a lot.

Excluding these dependencies is probably not OK either though.

Do we need a custom GH action for Jenkins dependencies to handle this, instead of Dependabot? ๐Ÿ˜ฆ

empty-plugin mode fails with JDK11

Jenkins and plugins versions report

Environment
Paste the output here

What Operating System are you using (both controller, and any agents involved in the problem)?

Windows 10 with Git Bash

Reproduction steps

  1. Have JDK11 early in PATH as the default
  2. Run mvn archetype:generate -Dfilter=io.jenkins.archetypes:
  3. Select 1. empty-plugin
  4. Select a name etc. (in my case N for defaults and picked all the group names etc.)

Expected Results

Successful generation (as it does happen when I export JAVA_HOME="C:\Program Files\Eclipse Adoptium\jdk-17.0.3.7-hotspot")

Actual Results

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate (default-cli) on project standalone-pom: could not access constructor: private java.io.File(java.lang.String,java.io.File) with arguments: [Jenkinsfile, C:\continuous-integration\jsl-types] reason: java.lang.IllegalAccessException: class org.codehaus.groovy.reflection.CachedConstructor cannot access a member of class java.io.File (in module java.base) with modifiers "private" -> [Help 1]

Anything else?

Originally PATH pointed to JDK11, even though MVN thought differently - that it has JDK17:

:; mvn -version
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: C:\progra~1\Apache\maven
Java version: 17.0.3, vendor: Eclipse Adoptium, runtime: C:\Program Files\Eclipse Adoptium\jdk-17.0.3.7-hotspot
Default locale: en_US, platform encoding: Cp1250
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

:; java -version
openjdk version "11.0.17" 2022-10-18
OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8)
OpenJDK 64-Bit Server VM Temurin-11.0.17+8 (build 11.0.17+8, mixed mode)

Exporting JDK17 JAVA_HOME and PATH explicitly did work around the issue:

:; export JAVA_HOME="C:\Program Files\Eclipse Adoptium\jdk-17.0.3.7-hotspot"
:; export PATH="$JAVA_HOME\bin:$PATH"

Still, as JDK11 is supposed to be a supported baseline for Jenkins, I think this is an issue to address (or document at least).

.gitignore copying appears broken again

mvn clean install
mvn archetype:generate -B -DarchetypeGroupId=io.jenkins.archetypes -DarchetypeArtifactId=empty-plugin -DhostOnJenkinsGitHub=true -DartifactId=my-app

no .gitignore file in output ๐Ÿ˜ข

ArchetypeCatalog is not supported anymore

Jenkins and plugins versions report

Environment
Paste the output here

What Operating System are you using (both controller, and any agents involved in the problem)?

macos

Reproduction steps

mvn archetype:generate -Dfilter=io.jenkins.archetypes:

Expected Results

generate any sample plugin unit test

Actual Results

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate (default-cli) on project archetypes-parent: archetypeCatalog 'abc.xml' is not supported anymore. Please read the plugin documentation for details. -> [Help 1]

Anything else?

If there is any other way to generate hello world plugin unit test samples, please provide that link/git repo.

Unit test HelloWorldBuilderTest.testScriptedPipeline() doesn't work.

Jenkins and plugins versions report

Environment
Paste the output here

What Operating System are you using (both controller, and any agents involved in the problem)?

Linux Ubuntu 18.04.6 LTS

Reproduction steps

  1. Create a new jenkins plugin project using archetype hello-world
  2. Run unit test method testScriptedPipeline() in the HelloWorldBuilderTest class.

Expected Results

Test executed successfully

Actual Results

java.lang.AssertionError: unexpected build status; build log was:

Started
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /tmp/j h7924288827949760219/workspace/test-scripted-pipeline
[Pipeline] {
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: cf7b083d-1dfd-456e-b0e9-d24a96e58bb2
java.lang.NoSuchMethodError: No such DSL method 'greet' found among steps [archive, bat, catchError, checkout, deleteDir, dir, echo, envVarsForTool, error, fileExists, getContext, input, isUnix, library, libraryResource, load, mail, node, parallel, powershell, properties, pwd, pwsh, readFile, readTrusted, resolveScm, retry, script, sh, sleep, stage, stash, step, timeout, tool, unarchive, unstable, unstash, validateDeclarativePipeline, waitUntil, warnError, withContext, withCredentials, withEnv, wrap, writeFile, ws] or symbols [agent, all, allBranchesSame, allOf, always, any, anyOf, apiToken, architecture, archiveArtifacts, artifactManager, batchFile, booleanParam, branch, buildButton, buildDiscarder, buildDiscarders, buildRetention, buildingTag, builtInNode, caseInsensitive, caseSensitive, certificate, changeRequest, changelog, changeset, checkoutToSubdirectory, choice, choiceParam, clock, command, credentials, cron, crumb, defaultDisplayUrlProvider, defaultFolderConfiguration, defaultView, demand, disableConcurrentBuilds, disableRestartFromStage, disableResume, downstream, dumb, durabilityHint, envVars, envVarsFilter, environment, equals, experimentalFlags, expression, file, fileParam, filePath, fingerprint, fingerprints, frameOptions, freeStyle, freeStyleJob, fromScm, fromSource, git, headRegexFilter, headWildcardFilter, hyperlink, hyperlinkToModels, inbound, installSource, isRestartedRun, jdk, jgit, jgitapache, jnlp, jobBuildDiscarder, jobName, label, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, legacy, legacySCM, list, local, location, logRotator, loggedInUsersCanDoAnything, mailer, masterBuild, maven, maven3Mojos, mavenErrors, mavenGlobalConfig, mavenMojos, mavenWarnings, modernSCM, multiBranchProjectDisplayNaming, multibranch, myView, namedBranchesDifferent, node, nodeProperties, none, nonresumable, not, organizationFolder, overrideIndexTriggers, paneStatus, parallelsAlwaysFailFast, parameters, password, pattern, permanent, pipeline, pipelineTriggers, plainText, plugin, pollSCM, preserveStashes, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, rateLimit, rateLimitBuilds, resourceRoot, retainOnlyVariables, run, runParam, schedule, scmRetryCount, scriptApproval, scriptApprovalLink, search, security, shell, simpleBuildDiscarder, skipDefaultCheckout, skipStagesAfterUnstable, slave, sourceRegexFilter, sourceWildcardFilter, sshUserPrivateKey, standard, status, string, stringParam, suppressAutomaticTriggering, suppressFolderAutomaticTriggering, swapSpace, tag, text, textParam, timezone, tmpSpace, toolLocation, triggeredBy, unsecured, untrusted, upstream, userSeed, usernameColonPassword, usernamePassword, viewsTabBar, weather, zip] or globals [currentBuild, env, params, pipeline, scm]
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:219)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:124)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:41)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:180)
at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:163)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:178)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:182)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:152)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
at org.jenkinsci.plugins.workflow.cps.LoggingInvoker.methodCall(LoggingInvoker.java:105)
at WorkflowScript.run(WorkflowScript:1)
at cps.transform(Native Method)
at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:90)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:116)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:85)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
at com.cloudbees.groovy.cps.Next.step(Next.java:83)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:152)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:146)
at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:136)
at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:275)
at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:146)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:187)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:422)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:330)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:294)
at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:97)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
at jenkins.util.ErrorLoggingExecutorService.lambda$wrap$0(ErrorLoggingExecutorService.java:51)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Finished: FAILURE


Expected: is
but: was
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at org.jvnet.hudson.test.JenkinsRule.assertBuildStatus(JenkinsRule.java:1502)
at org.jvnet.hudson.test.JenkinsRule.assertBuildStatus(JenkinsRule.java:1508)
at org.jvnet.hudson.test.JenkinsRule.assertBuildStatusSuccess(JenkinsRule.java:1536)
at com.nttdata.camaleo.jenkins.plugin.HelloWorldBuilderTest.testScriptedPipeline(HelloWorldBuilderTest.java:75)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:655)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.lang.Thread.run(Thread.java:829)

Anything else?

No response

Are you interested in contributing a fix?

No response

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Update maven:3.9.8 Docker digest to 41f6c1a

Detected dependencies

dockerfile
Dockerfile
  • docker/dockerfile 1.1.7-experimental
  • maven 3.9.8@sha256:7a3388321715e15d86f6b540deadeb5cf3e19ac939eda6b94e5e44c681782e9d
github-actions
.github/workflows/release-drafter.yml
  • release-drafter/release-drafter v6
common-files/.github/workflows/jenkins-security-scan.yml
  • jenkins-infra/jenkins-security-scan v2
common-files/.github/workflows/release-drafter.yml
  • release-drafter/release-drafter v6
maven
common-files/.mvn/extensions.xml
  • io.jenkins.tools.incrementals:git-changelist-maven-extension 1.8
empty-plugin/pom.xml
  • io.jenkins.archetypes:archetypes-parent 1.27-SNAPSHOT
empty-plugin/src/main/resources/archetype-resources/pom.xml
  • org.jenkins-ci.plugins:plugin 4.85
  • io.jenkins.tools.bom:bom-2.440.x 3208.vb_21177d4b_cd9
global-configuration/pom.xml
  • io.jenkins.archetypes:archetypes-parent 1.27-SNAPSHOT
global-configuration/src/main/resources/archetype-resources/pom.xml
  • org.jenkins-ci.plugins:plugin 4.85
  • io.jenkins.tools.bom:bom-2.440.x 3208.vb_21177d4b_cd9
hello-world/pom.xml
  • io.jenkins.archetypes:archetypes-parent 1.27-SNAPSHOT
hello-world/src/main/resources/archetype-resources/pom.xml
  • org.jenkins-ci.plugins:plugin 4.85
  • io.jenkins.tools.bom:bom-2.440.x 3208.vb_21177d4b_cd9
pom.xml
  • io.jenkins.tools:central-repository-pom 1.3
  • org.apache.maven.plugins:maven-archetype-plugin 3.2.1
  • org.apache.maven.archetype:archetype-packaging 3.2.1

  • Check this box to trigger a request for Renovate to run again on this repository

Unable to run tests of global-shared-library locally

I am unable to run the tests of the global-shared library archtype after creating it. I did nothing change and executed mvn clean compile test. I hope someone can help me.

I experience this with another shared library on my PC too. As soon as I import source files from shared-library/src/ it is unable to parse the file / execute the import and fails.

Java and Groovy version:

$ java -version
openjdk version "1.8.0-262"
OpenJDK Runtime Environment (build 1.8.0-262-b10)
OpenJDK 64-Bit Server VM (build 25.71-b10, mixed mode)

$ groovy -version
Groovy Version: 3.0.8 JVM: 1.8.0-262 Vendor: Oracle Corporation OS: Windows 10
mvn clean compile test:

file:/C:/Development/github/test/unit-tests/src/main/jenkins/io/jenkins/pipeline/sample/pipelineUsingSharedLib.groovy: 3: Error on loading library shared-library@master : Directory C:\Development\github\test\unit-tests\target\test-classes\libs\shared-library@master does not exists @ line 3, column 1.
   @Library('shared-library')
   ^

1 error

        at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:309)
        at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1107)
        at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:624)
        at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:602)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579)
        at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:323)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:293)
        at groovy.util.GroovyScriptEngine$ScriptClassLoader.doParseClass(GroovyScriptEngine.java:250)
        at groovy.util.GroovyScriptEngine$ScriptClassLoader.parseClass(GroovyScriptEngine.java:237)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:279)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:236)
        at groovy.util.GroovyScriptEngine.loadScriptByName(GroovyScriptEngine.java:562)
        at groovy.util.GroovyScriptEngine$loadScriptByName$0.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
        at com.lesfurets.jenkins.unit.PipelineTestHelper.loadScript(PipelineTestHelper.groovy:323)
        at com.lesfurets.jenkins.unit.PipelineTestHelper$loadScript$3.callCurrent(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:177)
        at com.lesfurets.jenkins.unit.PipelineTestHelper.runScript(PipelineTestHelper.groovy:339)
        at com.lesfurets.jenkins.unit.PipelineTestHelper$runScript$2.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:136)
        at com.lesfurets.jenkins.unit.BasePipelineTest.runScript(BasePipelineTest.groovy:111)
        at com.lesfurets.jenkins.unit.BasePipelineTest$runScript.callCurrent(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:169)
        at io.jenkins.pipeline.sample.TestSharedLibrary.library_annotation(TestSharedLibrary.groovy:39)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)


Results :

Tests in error:
(..)brary_annotation(io.jenkins.pipeline.sample.TestSharedLibrary): startup failed:

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Global Shared Library - Parent 1.0-SNAPSHOT:
[INFO]
[INFO] Global Shared Library - Tests ...................... FAILURE [  2.974 s]
[INFO] Global Shared Library - Parent ..................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.364 s
[INFO] Finished at: 2021-08-31T11:07:12+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project test: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Development\test\unit-tests\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.