我正在尝试编写一个OSGI类,该类应填充Felix Console中的配置对话框,如下所示。但是,当我尝试运行mvn clean install -PautoInstallPackage
时,会遇到以下错误。任何帮助都将不胜感激。
[错误]无法执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.2:编译 (默认编译)在项目Osgiexample上。CORE:编译失败
[错误] /E://osgiexample/core/src/main/java/osgiexample/core/serviceimpl/testserviceimpl.java:[40,10] 找不到符号
[错误]符号:类激活
[错误]位置: osgiexample.core.serviceimpl.testserviceimpl
@Component(immediate=true, label="TEST Service", description="Hello There - This is a Service component", metatype=true)
@Service(value=TestService.class)
public class TestServiceImpl implements TestService {
@Property(value="http://testservice/myservice?wsdl")
static final String SERVICE_ENDPOINT_URL = "service.endpoint.url";
private String serviceEndpointUrl;
@Override
public String getData() {
// TODO Auto-generated method stub
return null;
}
@Activate
public void activate(final Map<String, Object> props) {
System.out.println("Calling Activate Method");
this.serviceEndpointUrl = (String)props.get(SERVICE_ENDPOINT_URL);
System.out.println("ServiceEndpointUrl:" + this.serviceEndpointUrl);
}
}
添加下面的激活注释导入语句应解决您的问题
导入org.apache.felix.scr.annotations.activate;