Apache RAT

Apache RAT, pertenece al proyecto Apache Creadur. Por lo poco que he entendido, es para agregar licencias a todas tus clases, ficheros. Tal y como esta cualquier clase de Apache, donde aparece arriba del todo, despues de la palabra reservada package, la licencia.
Pero para salir de dudas, me he descargado la libreria y he realizado estas pruebas.

Dentro de la carpeta descomprimida, he creado la carpeta «test». En esta carpeta he metido una clase, que ha resultado ser una interfaz de un web service.
Ubicado en la carpeta descomprimida he ejecutado lo siguiente:

 
E01740@ES-D-04744LT /cygdrive/c/Software/apache-rat-0.10
$ java -jar apache-rat-0.10.jar --help
usage: java rat.report [options] [DIR|TARBALL]
Options
 -A,--addLicense                Add the default licence header to any file
                                with an unknown licence that is not in the
                                exclusion list. By default new files will
                                be created with the licence header, to
                                force the modification of existing files
                                use the --force option.
 -a,--addLicence                Add the default licence header to any file
                                with an unknown licence that is not in the
                                exclusion list. By default new files will
                                be created with the licence header, to
                                force the modification of existing files
                                use the --force option.
 -c,--copyright <arg>           The copyright message to use in the
                                licence headers, usually in the form of
                                "Copyright 2008 Foo"
 -d,--dir                       Used to indicate source when using
                                --exclude
 -E,--exclude-file <fileName>   Excludes files matching regular expression
                                in <file> Note that --dir is required when
                                using this parameter.
 -e,--exclude <expression>      Excludes files matching wildcard
                                <expression>. Note that --dir is required
                                when using this parameter. Allows multiple
                                arguments.
 -f,--force                     Forces any changes in files to be written
                                directly to the source files (i.e. new
                                files are not created)
 -h,--help                      Print help for the Rat command line
                                interface and exit
 -s,--stylesheet <arg>          XSLT stylesheet to use when creating the
                                report.  Not compatible with -x
 -x,--xml                       Output the report in raw XML format.  Not
                                compatible with -s

NOTE:
Rat is really little more than a grep ATM
Rat is also rather memory hungry ATM
Rat is very basic ATM
Rat highlights possible issues
Rat reports require intepretation
Rat often requires some tuning before it runs well against a project
Rat relies on heuristics: it may miss issues

Asi que si no lo he entendido mal. Si ejecuto esto:

 
$ java -jar apache-rat-0.10.jar -d test -a

*****************************************************
Summary
-------
Generated at: 2014-04-30T09:39:43+02:00
Notes: 0
Binaries: 0
Archives: 0
Standards: 1

Apache Licensed: 0
Generated Documents: 0

JavaDocs are generated and so license header is optional
Generated files do not required license headers

1 Unknown Licenses

*******************************

Unapproved licenses:

  test/Cargos.java

*******************************

Archives:

*****************************************************
  Files with Apache License headers will be marked AL
  Binary files (which do not require AL headers) will be marked B
  Compressed archives will be marked A
  Notices, licenses etc will be marked N
 !????? test/Cargos.java

*****************************************************
 Printing headers for files without AL header...


=======================================================================
==test/Cargos.java
=======================================================================
package es.depontevedra.soap.cargows.services;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.ws.BindingType;

@WebService
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
public interface Cargos {

        @WebMethod(action="crearCargo")
        public String crearCargo(String xml);

        @WebMethod(action="modificarCargo")
        public String modificarCargo(String xml);

        @WebMethod(action="anularCargo")
        public String anularCargo(String xml);

        @WebMethod(action="consultarCargo")
        public String consultarCargo(String xml);

        @WebMethod(action="consultarConceptos")
        public String consultarConceptos(String xml);

        @WebMethod(action="consultarTributos")
        public String consultarTributos(String xml);

        @WebMethod(action="obtenerRecibo")
        public String obtenerRecibo(String xml);

}

Parece que ha tocado algo en mi clase. La reviso:

 
package es.depontevedra.soap.cargows.services;
/*
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
*/

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.ws.BindingType;

@WebService
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
public interface Cargos {

	@WebMethod(action="crearCargo")
	public String crearCargo(String xml);
	
	@WebMethod(action="modificarCargo")
	public String modificarCargo(String xml);
	
	@WebMethod(action="anularCargo")
	public String anularCargo(String xml);
	
	@WebMethod(action="consultarCargo")
	public String consultarCargo(String xml);
	
	@WebMethod(action="consultarConceptos")
	public String consultarConceptos(String xml);
	
	@WebMethod(action="consultarTributos")
	public String consultarTributos(String xml);
	
	@WebMethod(action="obtenerRecibo")
	public String obtenerRecibo(String xml);
	
}

Me ha gustado eso del copyright que aparece en la ayuda. Voy a probar:

 
$ java -jar apache-rat-0.10.jar -d test -a -c "Jose Manuel Prieto Palacios"

Mi clase se queda:

 
package es.depontevedra.soap.cargows.services;
/*
 *
 * Jose Manuel Prieto Palacios
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
*/

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.ws.BindingType;

@WebService
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
public interface Cargos {

	@WebMethod(action="crearCargo")
	public String crearCargo(String xml);
	
	@WebMethod(action="modificarCargo")
	public String modificarCargo(String xml);
	
	@WebMethod(action="anularCargo")
	public String anularCargo(String xml);
	
	@WebMethod(action="consultarCargo")
	public String consultarCargo(String xml);
	
	@WebMethod(action="consultarConceptos")
	public String consultarConceptos(String xml);
	
	@WebMethod(action="consultarTributos")
	public String consultarTributos(String xml);
	
	@WebMethod(action="obtenerRecibo")
	public String obtenerRecibo(String xml);
	
}

Configurarlo con maven

Uso basico
En la fase de verificacion
Añadiendo un informe cuando el proyecto se compila
Aplicar una licencia personalizada

En maven simplemente se comprueba que todos los ficheros tienen licencia. Usar solo como verificador.

Apache RAT