【问题标题】:Error when compiling custom OpenDaylight API编译自定义 OpenDaylight API 时出错
【发布时间】:2016-06-28 23:39:31
【问题描述】:

我正在尝试根据https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:Startup_Project_Archetype 上的 API 教程创建自定义 API

工具:OpenDaylight Lithium、Eclipse、Maven 3.3.9

我可以编译api 中的文件夹,但不能编译impl (FlowImpl.java) 中的文件夹。

这是错误信息:

[INFO] Starting audit...
/home/shaoxu/Desktop/distribution-karaf-0.3.3-Lithium-SR3/flow/impl/src/main/java/org/opendaylight/flow/impl/FlowImpl.java:1: Line does not match expected header line of '^/[*]+$'.
Audit done.
[INFO] There is 1 error reported by Checkstyle 6.2 with check-license.xml ruleset.
[ERROR] src/main/java/org/opendaylight/flow/impl/FlowImpl.java[1] (header) RegexpHeader: Line does not match expected header line of '^/[*]+$'.

Eclipse 中没有错误消息。

这是源代码:

package org.opendaylight.flow.impl;

import java.util.concurrent.Future;

import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.flow.rev150105.FlowService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.flow.rev150105.FlowPathInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.flow.rev150105.FlowPathOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.flow.rev150105.FlowPathOutputBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;

public  class FlowImpl implements FlowService {

      @Override
        public Future<RpcResult<FlowPathOutput>> flowPath(FlowPathInput input) {
          FlowPathOutputBuilder flowBuilder = new FlowPathOutputBuilder();
          flowBuilder.setPath(input.getNodes());
            return RpcResultBuilder.success(flowBuilder.build()).buildFuture();
        }

}

什么是错误?

【问题讨论】:

    标签: eclipse api maven opendaylight


    【解决方案1】:

    您遇到的错误是由 OpenDaylight 中每个文件开头的版权/许可标题的强制格式引起的:

    /*
     * Copyright (c) 2016 ... and others.  All rights reserved.
     *
     * This program and the accompanying materials are made available under the
     * terms of the Eclipse Public License v1.0 which accompanies this distribution,
     * and is available at http://www.eclipse.org/legal/epl-v10.html
     */
    

    如果您使用原型,则应该已为您生成此标头。有两种方法可以解决这个问题:或者添加上面的许可证标题(如果你对许可证感到满意),或者禁用许可证检查——如果你想做后者,编辑你的问题并添加你的 POM重新使用impl,所以我可以解释如何去做。

    您提到您正在使用锂,我强烈建议您切换到铍甚至硼进行新的开发。 wiki 页面目前大多是铍的最新版本。

    【讨论】:

      【解决方案2】:

      在我的 Beryllium 中,我通常在运行构建时跳过 checkstyle 测试。将 -Dcheckstyle.skip=true 参数添加到您的命令中以进行 maven 构建。

      【讨论】:

        猜你喜欢
        • 2019-04-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多