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

Configuring mvn tool potential issue #170

Closed
MadsNielsen opened this issue Apr 9, 2018 · 1 comment · Fixed by #338
Closed

Configuring mvn tool potential issue #170

MadsNielsen opened this issue Apr 9, 2018 · 1 comment · Fixed by #338
Assignees

Comments

@MadsNielsen
Copy link
Member

MadsNielsen commented Apr 9, 2018

I'm having issues configuring a maven tool with configuration as code. The issue seems to be that Configuration-as-Code is confused as to what configurator to use.

We've got this from the configuration:
tools

So i started out with just trying to get it to work (Maven installations only require a name)

tool:
  maven:
     installations:
      - name: "myInstallation"

Which gives me:

jenkins_1  | Caused by: java.lang.IllegalArgumentException: Invalid configuration elements for type class jenkins.mvn.GlobalMavenConfig : installations
jenkins_1  | 	at org.jenkinsci.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:200)
jenkins_1  | 	at org.jenkinsci.plugins.casc.DescriptorConfigurator.configure(DescriptorConfigurator.java:45)
jenkins_1  | 	at org.jenkinsci.plugins.casc.DescriptorConfigurator.configure(DescriptorConfigurator.java:12)
jenkins_1  | 	at org.jenkinsci.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:188)
jenkins_1  | 	at org.jenkinsci.plugins.casc.GlobalConfigurationCategoryConfigurator.configure(GlobalConfigurationCategoryConfigurator.java:45)
jenkins_1  | 	at org.jenkinsci.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:208)
jenkins_1  | 	... 28 more
jenkins_1  | 

So it seems that Confguration as code tries to configure: https://github.com/jenkinsci/jenkins/blob/08def67a18eee51de9f3f99bc2a792fee1c160e0/core/src/main/java/jenkins/mvn/GlobalMavenConfig.java

While...i think it's supposed to configure: https://github.com/jenkinsci/jenkins/blob/d688c154907d17e75ea31067c8fc2525aa679584/core/src/main/java/hudson/tasks/Maven.java#L666

@ndeloof @oleg-nenashev Are my assumption correct, in that we're configuring the wrong thing via casc?

@ndeloof
Copy link
Contributor

ndeloof commented Apr 9, 2018

Unfortunately GlobalConfiguration use the "tools" category (ToolConfigurationCategory) and as a result is listed here, while Maven task's ToolDescriptor (same "tools" category) declare @Symbol("maven").

Not sure what can be done here to disambiguate. A possible workaround would be for GlobalConfiguration to expose get/setInstallations methods to delegate to Maven. DescriptorImpl

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

Successfully merging a pull request may close this issue.

2 participants