1

I am trying to create a custom API based on an API tutorial on https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:Startup_Project_Archetype

Tools: OpenDaylight Lithium, Eclipse, Maven 3.3.9

I am able to compile the folder in api but not in impl (FlowImpl.java).

This is the error message:

[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 '^/[*]+$'.

There is no error message in Eclipse.

This is the source code:

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();
        }

}

What is the error?

4

2 回答 2

2

您遇到的错误是由 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 页面目前大多是铍的最新版本。

于 2016-06-27T16:58:17.983 回答
0

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

于 2016-06-28T15:39:31.357 回答