Class MvnUtils

java.lang.Object
com.vaadin.uitest.generator.utils.MvnUtils

public class MvnUtils extends Object
  • Constructor Details

    • MvnUtils

      public MvnUtils()
  • Method Details

    • addMavenDependency

      public static boolean addMavenDependency(String pomFilePath, String groupId, String artifactId, String version, String scope) throws Exception
      Adds a Maven dependency to the specified pom.xml file.
      Parameters:
      pomFilePath - The path to the pom.xml file.
      groupId - The group ID of the dependency to add.
      artifactId - The artifact ID of the dependency to add.
      version - The version of the dependency to add, or null if not specified.
      scope - The scope of the dependency to add, or null if not specified.
      Returns:
      true if the pom.xml was modified, false otherwise.
      Throws:
      Exception - If an error occurs while reading or writing the file.
    • addMavenExecPlugin

      public static boolean addMavenExecPlugin(String pomFilePath) throws Exception
      Adds the exec-maven-plugin to the specified pom.xml file for executing Hilla tests. The plugin is added to the 'it' profile.
      Parameters:
      pomFilePath - The path to the pom.xml file.
      Returns:
      true if the pom.xml was modified, false if the plugin was already present.
      Throws:
      Exception - If an error occurs while reading or writing the file.
    • addMavenFailsafePlugin

      public static boolean addMavenFailsafePlugin(String pomFilePath) throws Exception
      Adds the maven-failsafe-plugin to the specified pom.xml file. The plugin is added to the 'it' profile.
      Parameters:
      pomFilePath - The path to the pom.xml file.
      Returns:
      true if the pom.xml was modified, false if the plugin was already present.
      Throws:
      Exception - If an error occurs while reading or writing the file.
    • isDependencyManagementPresent

      public static boolean isDependencyManagementPresent(String pathToPom)
      Checks if the given pom.xml file contains a non-empty list of dependency nodes inside the <dependencyManagement> section.
      Parameters:
      pathToPom - The file path to the
                  pom.xml
                  
      .
      Returns:
      true if the <dependencyManagement> section exists and contains at least one dependency; false otherwise.
    • isSpringBootProject

      public static boolean isSpringBootProject(String path) throws Exception
      Throws:
      Exception
    • addSpringBootPluginToItProfile

      public static boolean addSpringBootPluginToItProfile(String pomFilePath) throws Exception
      Throws:
      Exception