Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

put header instide a pom.xml to support multi module projects and "path" to the header #36

Closed
lukastymo opened this issue Jan 13, 2014 · 2 comments
Assignees
Labels
is:support Support, help or questions

Comments

@lukastymo
Copy link

In multi modules pom there is no easy way to use license-maven-plugin.

The problem is that placing the header in a file inside the root module, is accessible only from the root project. Only adding a property which refers to the root like this:

< headerUrl >${basedir}/..< / headerUrl >

for each child modules solves the problem.

My proposition is to add tag which allows placing CDATA string header inside the xml instead of file, then all child poms would have the same header. So no additional configuration in child poms would be necessary.

@matthesrieke
Copy link

how about disabling the plugin in the sub-modules? maybe this fits for your setup. I am currently attaching the license checking to the initialize phase, but only on the root project.

<plugin>
    <groupId>com.mycila</groupId>
    <artifactId>license-maven-plugin</artifactId>
    <version>2.2</version>
    <inherited>false</inherited>
    <configuration>
        <header>${license.header.file}</header>
        <aggregate>true</aggregate>
        <includes>
            <include>**/*.java</include>
        </includes>
        <properties>
            <inceptionYear>${project.inceptionYear}</inceptionYear>
            <latestYearOfContribution>${currentYear}</latestYearOfContribution>
        </properties>
    </configuration>
    <executions>
        <execution>
            <id>check-headers</id>
            <phase>initialize</phase>
            <goals>
                <goal>check</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Note <inherited>false</inherited> and <aggregate>true</aggregate> which are required to disable the execution in submodules and to crawl through the sub-modules src folders.

@mathieucarbou
Copy link
Owner

For sub-module projects, there is a lot of possibilities:

  1. Either use a default header MIT, Apache 2, etc. already contained in the plugin
    http://code.mycila.com/license-maven-plugin/#license-templates
    access using: classpath:/path/to/template
  2. Either create a single jar containing your license files and add this jar as a dependency of the plugin to access the header using classpath:/path/to/header
  3. Either define the MLP in a dependency management section with the path being the path used for your submodules and just use the dependency where you need in the submodules
  4. Either redefine the path in your submodules (=> redefine the plugin with another path)
  5. Use the proposed solution above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:support Support, help or questions
Projects
None yet
Development

No branches or pull requests

3 participants