All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.opentelemetry.maven.MavenUtils Maven / Gradle / Ivy

There is a newer version: 1.41.0-alpha
Show newest version
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package io.opentelemetry.maven;

import org.apache.maven.plugin.MojoExecution;

final class MavenUtils {
  private MavenUtils() {}

  /**
   * Shorten plugin identifiers.
   *
   * 

Examples: * *

    *
  • maven-clean-plugin -> clean *
  • sisu-maven-plugin -> sisu *
  • spotbugs-maven-plugin -> spotbugs *
* * @param pluginArtifactId the artifact ID of the mojo {@link MojoExecution#getArtifactId()} * @return shortened name */ static String getPluginArtifactIdShortName(String pluginArtifactId) { if (pluginArtifactId.endsWith("-maven-plugin")) { return pluginArtifactId.substring(0, pluginArtifactId.length() - "-maven-plugin".length()); } else if (pluginArtifactId.startsWith("maven-") && pluginArtifactId.endsWith("-plugin")) { return pluginArtifactId.substring( "maven-".length(), pluginArtifactId.length() - "-plugin".length()); } else { return pluginArtifactId; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy