Skip to content

Fail to download license file because license name contains invalid character #560

Closed

Description

@nhuongmh

Hi,
I was trying to download all license files using mvn license:download-licenses but there is an error throw because the file name that going to be saved contains illegal character spdx-license-identifier: mit - mit.html. We should replace all illegal characters for file name before before write content to file.

Configuration

<plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>license-maven-plugin</artifactId>
      <version>2.4.0</version>
      <executions>
          <execution>
              <id>default</id>
              <configuration>
                  <outputDirectory>${project.build.directory}</outputDirectory>
                  <thirdPartyFilename>THIRD-PARTY.txt</thirdPartyFilename>
                  <verbose>true</verbose>
              </configuration>
          </execution>
      </executions>
  </plugin>

Error:

[DEBUG] Downloading license(s) for project com.github.oshi:oshi-core-java11
[DEBUG] About to download 'https://opensource.org/licenses/MIT'
[DEBUG] Downloading 'https://opensource.org/licenses/MIT' -> 'C:\Users\username\git\projectx\target\generated-resources\licenses\spdx-license-identifier: mit - mit.html'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  20.418 s
[INFO] Finished at: 2024-04-17T15:44:45+07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:license-maven-plugin:2.4.0:download-licenses (default-cli) on project projectx: Execution default-cli of goal org.codehaus.mojo:license-maven-plugin:2.4.0:download-licenses failed: Illegal char <:> at index 135: C:\Users\username\git\projectx\target\generated-resources\licenses\spdx-license-identifier: mit - mit.html -> [Help 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions