Rafael Winterhalter
Rafael Winterhalter

Reputation: 44032

Using Maven license plugin in multimodule project

I am working on a multi-module projects where all modules share a common licence (Apache 2.0). Now I want to add headers to all source files and I want to configure this in the parent's pom.xml (packaging type is pom)

I created a folder license in the base dir and added a file licenses.properties where I state apache_2_0=apache_2_0. Also, I added a subfolder apache_2_0 where I have two files header.txt and license.txt. Now I added the following plugin to my parent pom:

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <version>1.5</version>
            <configuration>
                <licenseName>apache_2_0</licenseName>
                <licenseResolver>${project.basedir}/license</licenseResolver>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>update-file-header</goal>
                    </goals>
                    <phase>process-sources</phase>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

When I run this, I do however get an error message:

[ERROR] Failed to execute goal org.codehaus.mojo:license-maven-plugin:1.5:update-file-header (default) on project (myproject): could not obtain the license repository: unknown protocol: c -> [Help 1]

with the following exception:

java.net.MalformedURLException: unknown protocol: c

What am I doing wrong?

Upvotes: 2

Views: 1822

Answers (2)

christophenoel
christophenoel

Reputation: 308

Or simply use ${project.baseUri}

Upvotes: 0

willome
willome

Reputation: 3132

You have not defined any protocole (file://, http://, ...) on your licenseResolver

replace

<licenseResolver>${project.basedir}/license</licenseResolver>

with

<licenseResolver>file://${project.basedir}/license</licenseResolver>

Upvotes: 2

Related Questions