我有對RESTEasy JAX RS Client
編譯器沒有找到一個類我有隨着Maven依賴
我增加一條,作爲一個依賴於我的項目這樣的相關性的代碼:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.8.Final</version>
</dependency>
我通常可以寫代碼,但是當我嘗試編譯,我得到這些錯誤:
java: cannot access javax.ws.rs.client.ClientBuilder
class file for javax.ws.rs.client.ClientBuilder not found
java: cannot access javax.ws.rs.core.Link
class file for javax.ws.rs.core.Link not found
java: cannot access javax.ws.rs.client.WebTarget
class file for javax.ws.rs.client.WebTarget not found
雖然我通常可以找到這些類,我知道他們是在我的Maven的回購協議,如果我找一找全光照g我的IDE,我可以訪問它們,所以我知道它們存在。
我試着將依賴範圍改爲provided
和compile
只是爲了測試它,但沒有運氣。
任何想法可能會失蹤?
編輯
相關的pom.xml
<modelVersion>4.0.0</modelVersion>
<artifactId>my-project-id</artifactId>
<name>MyProject Name</name>
<dependencies>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.8.Final</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
類無法編譯
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;
import my.project.representations.App;
public class Main {
public static void main(String[] args) {
ResteasyClient client = new ResteasyClientBuilder().build();
ResteasyWebTarget target = client.target(SERVER_URL);
String token = "access_token";
target.register(new BearerTokenFilter(token));
Admin admin = target.proxy(Admin.class);
Realm realm = admin.realm("realm_name");
for (App app : realm.apps().findAll()) {
System.out.println(app.getName());
}
}
}
你是如何編譯的? – Fabian
我用IDE(IntelliJ IDEA)編譯了它,當我看到這個錯誤時,我嘗試通過maven'mvn clean install'編譯,它顯示了相同的問題 –
請儘可能'.pom'和一個源代碼失敗的源文件,如果可能的話最小的失敗的例子。 – Fabian