Regarding using the Mojohaus Maven license plugin, I figured some things
out and got a simple
test case to work, but then I ran into a problem regarding a real
repository with multiple
modules. Specifically, using {project.baseUri}/src/license to describe the
location of the license file
only works for files at the root of the project. This Q&A on on
StackOverflow
(
http://stackoverflow.com/questions/23274539/maven-license-plugin-use-license-for-parentpom-for-all-children
)
says to use a classpath:// protocol, instead of the {project.baleUri} but
then it also says:
"you really do need to have a separate package with the license files.
There doesn't seem to be a way to keep this information in the parent pom
project."

I don't quite understand how to create a separate package and where to put
it in the directory structure.
Can anyone point me to information that would help me understand what to
do? Is this worth pursuing?


Meanwhile, here is what I learned about the Mojohaus Maven license plugin:

1) You DO need a license/ folder under src/.

2) Inside the license/ folder you need a file called licenses.properties
(Some of the documentation
erroneously says "license.properties" instead of "licenses" - with an "s"
at the end.)

3) The licenses.properties file lists the licenses and needs one line per
license: e.g., apache_v2=Apache 2.0

4) Inside the license/ folder you also need a sub-folder with the name of
your license: e.g., apache_v2

5) Inside the apache_v2/ folder are the header.txt and license.txt files.

6) You can run mvn license:license-list to see the license names to use.
(Plus you can check licenses,
download licenses, get 3rd party reports, etc.)

7) This plugin inserts control characters (#%L and %%)  into the license,
for example:
/*-
 * #%L
 * Apache Taverna Server
 * %%
 * Copyright (C) 2015 - 2016 The Apache Software Foundation
 * %%
 * Licensed under the Apache License

8) Add the following to the pom.xml (Mojohaus apparently still uses
org.codehaus.mojo):
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>1.9</version>
<configuration>
<licenseName>apache_v2</licenseName>
<licenseResolver>${project.baseUri}/src/license</licenseResolver>
</configuration>
<executions>
<execution>
<id>generate-license-headers</id>
<goals>
<goal>update-file-header</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<roots>
<root>src/main/java</root>
</roots>
</configuration>
</execution>
</executions>

</plugin>


On Mon, Sep 5, 2016 at 10:17 AM Gale Naylor <[email protected]>
wrote:

> Oh! That's what you meant. Sorry - I thought you meant you added an Apache
> header. Thanks!!!
>
> On Mon, Sep 5, 2016 at 10:16 AM Stian Soiland-Reyes <[email protected]>
> wrote:
>
>> But I updated and removed all the mygrid links:
>>
>> https://github.com/apache/incubator-taverna-server/blob/master/.opf.yml
>>
>>
>> On 5 September 2016 at 17:20, Gale Naylor <[email protected]>
>> wrote:
>> > I'll have another look at the maven license header tomorrow. (Today is a
>> > holiday here.) And thanks for the information about settings: I just
>> took
>> > the defaults because I couldn't find answers in the documentation.
>> >
>> > As for the OPF file, my real questions are:
>> >
>> > Is there a reason to keep the pre-Apache information in an Apache
>> release?
>> > (Maybe we should update the information?)
>> >
>> > In particular, I'm wondering about pointing people to the Taverna Server
>> > 2.4 home page and to mygrid.org.uk for issues. Won't that be
>> > confusing/out-of-date?
>> >
>> > Thanks,
>> >
>> > Gale
>> >
>> > On Mon, Sep 5, 2016, 9:05 AM Stian Soiland-Reyes <[email protected]>
>> wrote:
>> >
>> >> Thanks for having a go!
>> >>
>> >> I am not sure to be honest what is the correct configuration of
>> >> license-maven-plugin.. I just spotted it had a update-file-header
>> >>
>> >> (BTW - We should not add SVN keywords, we use git!)
>> >>
>> >> One problem is that the codehaus.org has since disappeared - which
>> >> hosted many useful Maven plugins.
>> >>
>> >> Most of them are rescued here: http://www.mojohaus.org/ - aka
>> >> http://www.mojohaus.org/license-maven-plugin/
>> >>
>> >>
>> >>
>> >>
>> >> There's also the competing
>> >> http://code.mycila.com/license-maven-plugin/ which has a slightly
>> >> different kind of configuration.
>> >>
>> >>
>> >> It might be you would have to add a license template to a folder under
>> >> src/ somewhere first.
>> >>
>> >> On 2 September 2016 at 22:38, Gale Naylor <[email protected]
>> >
>> >> wrote:
>> >> > Also, I tried using the maven license plugin to add a license header
>> (to
>> >> a
>> >> > local file copies), but kept getting this error: "licenseName can
>> not be
>> >> > null nor empty." It's probably because I don't quite know how to use
>> this
>> >> > plugin. I followed the instructions here (
>> >> >
>> >>
>> http://www.mojohaus.org/license-maven-plugin/examples/update-file-header-config.html
>> >> )
>> >> > and here (
>> >> >
>> >>
>> http://stackoverflow.com/questions/22549517/how-to-use-the-the-license-maven-plugin
>> >> )
>> >> > and added the license plugin to the project pom.xml, but could not
>> >> resolve
>> >> > the error. One thing I couldn't find: where does the plugin get the
>> text
>> >> > for the license header?
>> >> >
>> >> > Here is what I added to the pom:
>> >> >
>> >> >
>> >> >       <plugin>
>> >> >         <groupId>org.codehaus.mojo</groupId>
>> >> >         <artifactId>license-maven-plugin</artifactId>
>> >> >         <version>1.9</version>
>> >> >         <configuration>
>> >> >           <verbose>false</verbose>
>> >> >           <addSvnKeyWords>true</addSvnKeyWords>
>> >> >         </configuration>
>> >> >         <executions>
>> >> >           <execution>
>> >> >             <id>generate-license-headers</id>
>> >> >             <goals>
>> >> >               <goal>update-file-header</goal>
>> >> >             </goals>
>> >> >             <phase>process-sources</phase>
>> >> >             <configuration>
>> >> >               <licenseName>Apache 2.0</licenseName>
>> >> >               <roots>
>> >> >                 <root>src/main/java</root>
>> >> >               </roots>
>> >> >             </configuration>
>> >> >           </execution>
>> >> >         </executions>
>> >> >       </plugin>
>> >> >
>> >> > Cheers! Have a nice weekend.
>> >> >
>> >> > Gale
>> >> >
>> >> >
>> >> > On Fri, Sep 2, 2016 at 2:33 PM Gale Naylor <
>> [email protected]>
>> >> > wrote:
>> >> >
>> >> >> I downloaded a zip of incubator-taverna-server from GitHub and ran
>> the
>> >> RAT
>> >> >> check from the command line on each of the main and sub folders. It
>> >> looks
>> >> >> like almost all the files need a header.
>> >> >>
>> >> >> One if the files is the .opf.yml file, which contains references to
>> >> >> mygrid.org.uk and taverna.org.uk.:
>> >> >>
>> >> >> name: Taverna Server
>> >> >> vendor: The University of Manchester
>> >> >> maintainer:
>> >> >> name: Donal Fellows
>> >> >> email: donal.k.fellows( AT )manchester.ac.uk
>> >> >> platform: "Java 6+, Tomcat 6, POSIX"
>> >> >> download: http://www.taverna.org.uk/download/server/
>> >> >> # Really the documentation page as the overall home page is shared
>> with
>> >> >> the workbench but will do for now
>> >> >> homepage:
>> >> http://dev.mygrid.org.uk/wiki/display/taverna/Taverna+Server+2.4
>> >> >> issues: http://dev.mygrid.org.uk/issues/browse/TAVSERV
>> >> >> # Note, no anti-spam armouring required for this one
>> >> >> support-contact: [email protected]
>> >> >>
>> >> >> I'm guessing this information needs to be updated, too?
>> >> >>
>> >> >> Gale
>> >> >>
>> >> >> On Fri, Sep 2, 2016 at 8:41 AM Stian Soiland-Reyes <
>> >> >> [email protected]> wrote:
>> >> >>
>> >> >>> Hi,
>> >> >>>
>> >> >>> I've made
>> >> >>>
>> >> >>>
>> >>
>> https://cwiki.apache.org/confluence/display/TAVERNADEV/2016-09+License+review
>> >> >>>
>> >> >>> so we can track license review progress.
>> >> >>>
>> >> >>>
>> >> >>> Anyone is welcome to keep checking/fixing those that are not
>> complete
>> >> >>> - as I've mentioned it's fine to remove the (C) Manchester/LGPL
>> >> >>> headers as they are part oft he software grant.
>> >> >>>
>> >> >>> It should be possible to do the license header updates using the
>> maven
>> >> >>> license plugin rather than a large vim session..
>> >> >>>
>> >> >>> --
>> >> >>> Stian Soiland-Reyes, eScience Lab
>> >> >>> School of Computer Science
>> >> >>> The University of Manchester
>> >> >>> http://orcid.org/0000-0001-9842-9718
>> >> >>>
>> >> >>
>> >>
>> >>
>> >>
>> >> --
>> >> Stian Soiland-Reyes
>> >> http://orcid.org/0000-0001-9842-9718
>> >>
>>
>>
>>
>> --
>> Stian Soiland-Reyes
>> http://orcid.org/0000-0001-9842-9718
>>
>

Reply via email to