我有两个maven模块,AppManager和myApp.它们位于本地的同一目录中,并且在公司的在线仓库中不可用,因为它们用于测试目的.在IntelliJ中,使用AppManager的字段和方法没有问题,也没有错误消息.我在myApp的impl pom文件中导出com.mycompany.appManager.但是,当我在IDE之外构建时,即mvn clean install包含的错误com.mycompany.appManager不存在,然后是未解析的符号的相关错误,以便在appManager中定义公共字段的使用.我该如何解决这个问题?我已尝试导出并添加依赖项,但这两个解决方案不起作用.
pom.xml中:
<moduleVersion>4.0.0</moduleVersion>
<parent>
<groupId>com.myCompany</groupId>
<artifactId>myApp</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.myCompany.myApp</groupId>
<artifactId>com.myCompany.myApp.impl</artifactId>
<packaging>bundle</packaging>
<name>My App Implementation</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>
com.myCompany.appmanager
</Export-Package>
<Bundle-Activator>com.mycompany.myapp.impl.component</Bundle-Activator>
</instructions>
</configuration>
</plugin>
</plugin>
</build>
Run Code Online (Sandbox Code Playgroud)
编译错误:
[ERROR] /root/Desktop/apps/myapp/impl/src/main/java/com/mycompany/myApp/impl/component.java:[11,49] package com.mycompany.appmanager does not exist
[ERROR] /root/Desktop/apps/myapp/impl/src/main/java/com/mycompany/myApp/impl/component.java:[64,49] cannot find symbol
symbol: variable AppManagerModule
location: class com/mycompany/myApp/impl/component
Run Code Online (Sandbox Code Playgroud) 我ReaderListener在与Swagger的资源类相同的包中实现了。但是,在生成Swagger文件时,永远不会使用此类。我尝试添加swagger.setBasePath("/empty");到afterScan()只是为了看看它被称为可言,检查它是否改变了基本路径,但事实并非如此。关于我需要做些什么来确保在Swagger的扫描过程中获得此类的任何想法?顺便说一句,我正在用Maven构建项目并安装所生成的RPM(如果有区别的话)。
@io.swagger.annotations.SwaggerDefinition
public class SwaggerDefinition implements ReaderListener {
@Override
public void beforeScan(Reader reader, Scanner scanner) {
}
@Override
public void afterScan(Reader reader, Scanner scanner) {
final Model model = new ModelImpl()
.name("EntryContainer")
.type("Object")
.required("entry")
.property("entry", new ObjectProperty());
model.setReference("#/definitions/entry");
final Model model1 = new ModelImpl()
.name("Entry")
.type("Object")
.property("first_name", new StringProperty())
.property("last_name", new StringProperty())
.required("first_name")
.required("last_name");
Map<String, Model> defs = new HashMap<>();
definitions.put("EntryContainer", model);
definitions.put("Entry", model1);
swagger.setDefinitions(definitions);
}
}
Run Code Online (Sandbox Code Playgroud)