编译自定义OpenDaylight API时出错

时间:2016-06-23 05:17:23

标签: eclipse api maven opendaylight

我正在尝试基于https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:Startup_Project_Archetype

上的API教程创建自定义API

工具:OpenDaylight Lithium,Eclipse,Maven 3.3.9

我可以在api中编译该文件夹,但不能在implFlowImpl.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();
        }

}

错误是什么?

2 个答案:

答案 0 :(得分: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所以我可以解释如何去做。

你提到你正在使用锂,我强烈建议转用铍或甚至硼来进行新的开发。维基页面目前主要是铍的最新版本。

答案 1 :(得分:0)

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