mojohaus/license-maven-plugin

License plugin breaks Groovy code

Open

#151 opened on Oct 6, 2018

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Java (127 forks)auto 404
bugfile-headerhelp wanted

Repository metrics

Stars
 (115 stars)
PR merge metrics
 (PR metrics pending)

Description

Code:

    @Test
    void "submit callable task +short timeout"() {
        boolean taskRun = false
        def task = { Thread.sleep 2000; taskRun = true }
        def future = watchdog.submit(task)

        def notFinished
        assertTimeout(ofSeconds(3) { notFinished = watchdog.waitForTasks dparse("PT1S") })
        assert notFinished.size() == 1
        assert taskRun == false
    }

License is inserted between code:

    @Test
    void "submit callable task +short timeout"() {
        boolean taskRun = false
        def task = { Thread.sleep 2000;

/*-
 * #%L
 * Global POM Utilities :: Threads
 * %%
 * Copyright (C) 2013 - 2018 Advanced Natural Research Institute
 * %%
 * 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.
 * #L%
 */
taskRun = true }
        def future = watchdog.submit(task)

        def notFinished
        assertTimeout(ofSeconds(3) { notFinished = watchdog.waitForTasks dparse("PT1S") })
        assert notFinished.size() == 1
        assert taskRun == false
    }

Plugin:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <version>1.16</version>
        <executions>
          <execution>
            <id>generate-license-headers</id>
            <phase>process-sources</phase>
            <goals>
              <goal>update-file-header</goal>
            </goals>
            <configuration>
              <licenseName>apache_v2</licenseName>
              <roots>
                <root>src</root>
              </roots>
            </configuration>
          </execution>
          <execution>
            <id>download-licenses</id>
            <goals>
              <goal>download-licenses</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

Contributor guide