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

ClasscastException in kubernetes-maven-plugin #2093

Closed
rhierlmeier opened this issue Mar 22, 2023 · 0 comments · Fixed by #2095
Closed

ClasscastException in kubernetes-maven-plugin #2093

rhierlmeier opened this issue Mar 22, 2023 · 0 comments · Fixed by #2095
Assignees
Labels
bug Something isn't working
Milestone

Comments

@rhierlmeier
Copy link

rhierlmeier commented Mar 22, 2023

Describe the bug

I run into the following exception with the maven-kubernetes-plugin:

> mvn -e clean install
...
rg.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.jkube:kubernetes-maven-plugin:1.11.0:build (docker-build-app) on project kubernetes-sample: A type incompatibility occurred while executing org.eclipse.jkube:kubernetes-maven
-plugin:1.11.0:build: class java.util.HashMap cannot be cast to class java.lang.String (java.util.HashMap and java.lang.String are in module java.base of loader 'bootstrap')
...
Caused by: java.lang.ClassCastException: class java.util.HashMap cannot be cast to class java.lang.String (java.util.HashMap and java.lang.String are in module java.base of loader 'bootstrap')
    at org.eclipse.jkube.kit.common.util.MavenConfigurationExtractor.addAsList (MavenConfigurationExtractor.java:73)
    at org.eclipse.jkube.kit.common.util.MavenConfigurationExtractor.getElement (MavenConfigurationExtractor.java:54)
    at org.eclipse.jkube.kit.common.util.MavenConfigurationExtractor.getElement (MavenConfigurationExtractor.java:59)
    at org.eclipse.jkube.kit.common.util.MavenConfigurationExtractor.getElement (MavenConfigurationExtractor.java:59)
    at org.eclipse.jkube.kit.common.util.MavenConfigurationExtractor.getElement (MavenConfigurationExtractor.java:59)
    at org.eclipse.jkube.kit.common.util.MavenConfigurationExtractor.extract (MavenConfigurationExtractor.java:41)
    at org.eclipse.jkube.kit.common.util.MavenUtil.getPlugins (MavenUtil.java:73)
    at org.eclipse.jkube.kit.common.util.MavenUtil.convertMavenProjectToJKubeProject (MavenUtil.java:205)
    at org.eclipse.jkube.maven.plugin.mojo.build.AbstractDockerMojo.doExecute (AbstractDockerMojo.java:434)
    at org.eclipse.jkube.maven.plugin.mojo.build.AbstractDockerMojo.execute (AbstractDockerMojo.java:413)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)

Maven-Version:

> mvn -v
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: C:\ProgrammeDE\Java\tools\apache-maven-3.8.6
Java version: 17.0.4, vendor: Eclipse Adoptium, runtime: C:\ProgrammeDE\Java\jdk17.0.4_8-win64
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Eclipse JKube version

1.11.0

Component

Kubernetes Maven Plugin

Apache Maven version

other (please specify in additional context)

Gradle version

None

Steps to reproduce

  1. Add the following maven plugin to pom.xml that has also the kubernetes-maven-plugin configured
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-checkstyle-plugin</artifactId>
        <version>3.2.1</version>
	<configuration>
		<checkstyleRules>
			<module name="Checker">
				<module name="TreeWalker">
					<module name="IllegalImport">
						<property name="severity" value="warning" />
						<property name="illegalPkgs" value="sun, edu"/>
					</module>

					<module name="RedundantImport"/>
				</module>
			</module>
		</checkstyleRules>
		....
	</configuration>
</plugin>
  1. Run mvn install

The <module name="RedundantImport"/> causes the exception. When I change it to

<module name="RedundantImport">
     <property name="severity" value="warning" />
</module>

then the exception does no longer occur.

Expected behavior

The configuration of the checkstyle-maven-plugin is a valid Maven configuration.
The kubernetes-maven-plugin should work with such a configuration

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

1.25.3

Environment

Windows

Eclipse JKube Logs

No response

Sample Reproducer Project

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants