This is an automated email from the ASF dual-hosted git repository. rzo1 pushed a commit to branch tomee-10.x in repository https://gitbox.apache.org/repos/asf/tomee.git
commit ea32137f68cedf168cdadd0aca0fc81ea41d504a Author: Mark Struberg <[email protected]> AuthorDate: Sun Jul 5 21:42:31 2026 +0200 fix further tomee-maven-plugin tests Those tests refer to dependencie versions which are not available after a fresh notebook setup. (cherry picked from commit d8dd2bfffe33ff4283c984cdb6e4d8cc1ad04002) --- .../plugin/test/ClasspathCustomizationTest.java | 8 +---- .../openejb/maven/plugin/test/ClasspathHelper.java | 37 ++++++++++++++++++++++ .../maven/plugin/test/StripVersionTest.java | 6 +++- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/ClasspathCustomizationTest.java b/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/ClasspathCustomizationTest.java index 771bd370dd..22cec99dd4 100644 --- a/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/ClasspathCustomizationTest.java +++ b/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/ClasspathCustomizationTest.java @@ -52,12 +52,6 @@ public class ClasspathCustomizationTest { } private static String resolveLog4jVersion() { - for (final String entry : System.getProperty("java.class.path", "").split(File.pathSeparator)) { - if (entry.contains("log4j-api-") && entry.endsWith(".jar")) { - final String name = new File(entry).getName(); - return name.substring("log4j-api-".length(), name.length() - ".jar".length()); - } - } - throw new IllegalStateException("log4j-api jar not found on classpath"); + return ClasspathHelper.getJarVersion("log4j-api"); } } diff --git a/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/ClasspathHelper.java b/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/ClasspathHelper.java new file mode 100644 index 0000000000..60b2c5110b --- /dev/null +++ b/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/ClasspathHelper.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.maven.plugin.test; + +import java.io.File; + +public class ClasspathHelper { + + /** + * @param jarName e.g. "log4j-api" + * @return the version of the dependency with the given name + */ + public static String getJarVersion(String jarName) { + final String jarPrefix = jarName + "-"; + for (final String entry : System.getProperty("java.class.path", "").split(File.pathSeparator)) { + if (entry.contains(jarPrefix) && entry.endsWith(".jar")) { + final String name = new File(entry).getName(); + return name.substring(jarPrefix.length(), name.length() - ".jar".length()); + } + } + throw new IllegalStateException(jarName + " jar not found on classpath"); + } +} diff --git a/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/StripVersionTest.java b/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/StripVersionTest.java index d0e86cab66..59a153e89e 100644 --- a/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/StripVersionTest.java +++ b/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/StripVersionTest.java @@ -36,7 +36,11 @@ public class StripVersionTest { private final List<String> javaagents = singletonList("org.apache.sirona:sirona-javaagent:0.2-incubating:jar:shaded"); @Config - private final List<String> libs = singletonList("org.codehaus.plexus:plexus-utils:3.0.17"); + private final List<String> libs = singletonList("org.codehaus.plexus:plexus-utils:" + getPlexusVersion()); + + private String getPlexusVersion() { + return ClasspathHelper.getJarVersion("plexus-utils"); + } @Config private final List<String> webapps = singletonList("org.apache.tomee:tomee-webaccess:7.0.0" /*use release to avoid nasty deps*/);
