-1

i have a maven project but i want tu run specific part with maven profile with calling specific plugin i do that:

mvn -Pcve-report org.codehaus.mojo:wagon-maven-plugin:upload -T0.8C -DskipTests

(this syntax work with others plugins) But my parameters (version, url etc...) are not considered by maven and return:

[ERROR] Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:2.0.2:upload (default-cli) on project project-script: The parameters 'url' for goal org.codehaus.mojo:wagon-maven-plugin:2.0.2:upload are missing or invalid -> [Help 1]
[ERROR] Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:2.0.2:upload (default-cli) on project project-persistence-base-tests: The parameters 'url' for goal org.codehaus.mojo:wagon-maven-plugin:2.0.2:upload are missing or invalid -> [Help 1]
[ERROR] Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:2.0.2:upload (default-cli) on project project-annotation-processor-tests: The parameters 'url' for goal org.codehaus.mojo:wagon-maven-plugin:2.0.2:upload are missing or invalid -> [Help 1]
[ERROR] Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:2.0.2:upload (default-cli) on project project: The parameters 'url' for goal org.codehaus.mojo:wagon-maven-plugin:2.0.2:upload are missing or invalid -> [Help 1]
[ERROR] Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:2.0.2:upload (default-cli) on project project-annotation-processor: The parameters 'url' for goal org.codehaus.mojo:wagon-maven-plugin:2.0.2:upload are missing or invalid -> [Help 1]
[ERROR] Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:2.0.2:upload (default-cli) on project project-monitor-core: The parameters 'url' for goal org.codehaus.mojo:wagon-maven-plugin:2.0.2:upload are missing or invalid -> [Help 1]

My profile part POM:

<profiles>
    <profile>
      <id>cve-report</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
            <artifactId>wagon-maven-plugin</artifactId>
            <version>1.0</version>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>com.github.carlomorelli</groupId>
            <artifactId>licensescan-maven-plugin</artifactId>
            <version>2.1</version>
            <configuration>
              <printLicenses>true</printLicenses>
              <blacklistedLicenses>
                <license>GNU General Public License, v2.0</license>
                <license>GNU General Public License, v3.0</license>
                <license>regex:.*Affero.*</license> <!-- to enable use of wildcards, use string prefix 'regex:' -->
              </blacklistedLicenses>
              <failBuildOnBlacklisted>false</failBuildOnBlacklisted>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.owasp</groupId>
            <artifactId>dependency-check-maven</artifactId>
            <version>7.1.2</version>
            <configuration>
                <failBuildOnCVSS>11</failBuildOnCVSS>
                <formats>
                  <format>html</format>
                  <format>json</format>
                </formats>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>wagon-maven-plugin</artifactId>
            <version>1.0</version>
            <executions>
              <execution>
                <goals>
                    <goal>upload</goal>
                </goals>
                <configuration>
                    <fromDir>target/</fromDir>
                    <includes>**/*</includes>
                    <excludes>pom.xml</excludes>
                    <url>dav:https://myurl.com</url>
                    <toDir>cve/${project.groupId}/${project.artifactId}//${project.version}</toDir>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  <build>
    <extensions>
      <extension>
          <groupId>org.apache.maven.wagon</groupId>
          <artifactId>wagon-webdav</artifactId>
          <version>1.0-beta-2</version>
      </extension>
    </extensions>
  </build>
  <pluginRepositories>
    <pluginRepository>
      <id>jitpack.io</id>
      <url>https://jitpack.io</url>
    </pluginRepository>
  </pluginRepositories>

I tried to delete my .m2/repository, change the version to 2.0.0/2.0.1 and it don't considerate my parameters and build is failing. If anyone has any idea what is causing the problem it would be very helpful.

Rems
  • 1
  • 2
  • The current configuration of your plugin is only available in the execution segment, as it is defined there. When you run the plugin from the command line, it looks for the general configuration by default. So either specify that, or run a specific execution by id: https://stackoverflow.com/questions/3779369/run-a-single-maven-plugin-execution – slindenau Sep 13 '22 at 14:02

1 Answers1

0

I've solved my problem:

It was a problem related to child modules, in fact when I executed my command the upload program tried to run on child modules. To avoid this I had to add the tag:

<inherited>false</inherited>
Rems
  • 1
  • 2