7

我正在使用 Maven 项目在 Eclipse 中为sonarqube创建一个新的语言插件,并且在构建项目时遇到以下错误:

Failed to execute goal com.mycila.maven-license-plugin:maven-license-plugin:1.9.0:
check (enforce-license-headers) on project sonar-java-plugin:
Some files do not have the expected license header -> [Help 1]
4

3 回答 3

6

我自己在开发插件时遇到了这个问题。我认为您正在使用 sonar--plugin-archetype 来创建您的环境。如果您这样做,您的整个项目都在 GNU 3 许可下,并且每个类中的标题都应该说明这一点。预定义的 pom.xml 包含定义 this 的部分。在你的 pom.xml 中搜索“license”并删除这部分。

如果这不能解决您的问题,只需添加-Dlicense.skip=true到您的 Maven 目标。

预期的标题是这样的(请注意,在您使用 -sonar-archetype 时设置了第一件事)

/*
 * MyLanguage Plugin
 * Copyright (C) MyYear MyCompany
 * dev@sonar.codehaus.org
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
 */
于 2014-05-13T12:05:50.470 回答
0

添加-Dlicense.skip=true到 Maven 目标应该会有所帮助。

事实上,它对我有帮助!

于 2017-09-29T07:37:30.543 回答
-1

声纳服务器安装:

添加涉及的步骤:

Download Sonar Setup File from http://www.sonarqube.org/downloads/
Extract the Zip file on your location. e.g. /home/<yourname>/sonar-version

Running SonarQube Server:

~/sonar-version/bin/{your_os} > ./sonar.sh start

After the server is started you can check it on your browser using url localhost:9000 

安装声纳 Eclipse 插件:

From your Eclipse search for Sonar  in Eclipse Marketplace and install the plugin.

 In your Eclipse go to.
    Windows > Preference > Sonar > Server

Click Add and in Add Window the Sonar Server URL must be http://localhost:9000. Then you should get the Successfully Connected ! message. Click Finish.
Close all the Eclipse pop up windows.

在这个阶段,您已经成功地将您的 Eclipse 与您之前设置的 Sonar 服务器连接起来。

Command: mvn sonar:sonar

谢谢。

于 2014-05-09T06:47:27.370 回答