maven-hpi-plugin
maven-hpi-plugin copied to clipboard
`hpi:run` fails in a newly initialized Git repo due to `AbstractHpiMojo.getGitHeadSha1`
Jenkins and plugins versions report
n/a
What Operating System are you using (both controller, and any agents involved in the problem)?
n/a
Reproduction steps
-
mvn archetype:create …
-
cd pluginId
-
git init
-
mvn hpi:run
Expected Results
It works like if there was no Git repo
Actual Results
[ERROR] Failed to execute goal org.jenkins-ci.tools:maven-hpi-plugin:3.22:run (default-cli) on project hpibug: Execution default-cli of goal org.jenkins-ci.tools:maven-hpi-plugin:3.22:run failed: String index out of range: 8 -> [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/PluginExecutionException
With -e
:
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 8
at java.lang.String.substring (String.java:1963)
at org.jenkinsci.maven.plugins.hpi.AbstractHpiMojo.getGitHeadSha1 (AbstractHpiMojo.java:920)
at org.jenkinsci.maven.plugins.hpi.AbstractJenkinsManifestMojo.setAttributes (AbstractJenkinsManifestMojo.java:185)
at org.jenkinsci.maven.plugins.hpi.HplMojo.execute (HplMojo.java:76)
at org.jenkinsci.maven.plugins.hpi.RunMojo.generateHpl (RunMojo.java:533)
at org.jenkinsci.maven.plugins.hpi.RunMojo.execute (RunMojo.java:374)
Anything else?
No response