Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java][RESTEasy] Gradle build failed while maven build succeeded #5925

Closed
wing328 opened this issue Jun 26, 2017 · 6 comments · Fixed by #6556
Closed

[Java][RESTEasy] Gradle build failed while maven build succeeded #5925

wing328 opened this issue Jun 26, 2017 · 6 comments · Fixed by #6556

Comments

@wing328
Copy link
Contributor

wing328 commented Jun 26, 2017

Description

Gradle build failed for Java RESTEasy Petstore sample while mvn test works fine. Here are the steps to repeat it:

swagger-codegen|master⚡ ⇒ cd samples/client/petstore/java/resteasy
resteasy|master⚡ ⇒ gradle test
:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7
/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/ApiClient.java:36: error: package org.jboss.logging does not exist
import org.jboss.logging.Logger;
                        ^
/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/ApiClient.java:37: error: package org.jboss.resteasy.client.jaxrs.internal does not exist
import org.jboss.resteasy.client.jaxrs.internal.ClientConfiguration;
                                               ^
/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/ApiClient.java:38: error: package org.jboss.resteasy.plugins.providers.multipart does not exist
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataOutput;
                                                     ^
/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/ApiClient.java:39: error: package org.jboss.resteasy.spi does not exist
import org.jboss.resteasy.spi.ResteasyProviderFactory;
                             ^
/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/ApiClient.java:445: error: cannot find symbol
      MultipartFormDataOutput multipart = new MultipartFormDataOutput();  
      ^
  symbol:   class MultipartFormDataOutput
  location: class ApiClient
/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/ApiClient.java:445: error: cannot find symbol
      MultipartFormDataOutput multipart = new MultipartFormDataOutput();  
                                              ^
  symbol:   class MultipartFormDataOutput
  location: class ApiClient
/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/ApiClient.java:649: error: cannot find symbol
    final ClientConfiguration clientConfig = new ClientConfiguration(ResteasyProviderFactory.getInstance());
          ^
  symbol:   class ClientConfiguration
  location: class ApiClient
/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/ApiClient.java:649: error: cannot find symbol
    final ClientConfiguration clientConfig = new ClientConfiguration(ResteasyProviderFactory.getInstance());
                                                 ^
  symbol:   class ClientConfiguration
  location: class ApiClient
/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/ApiClient.java:649: error: cannot find symbol
    final ClientConfiguration clientConfig = new ClientConfiguration(ResteasyProviderFactory.getInstance());
                                                                     ^
  symbol:   variable ResteasyProviderFactory
  location: class ApiClient
/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/ApiClient.java:652: error: cannot find symbol
      clientConfig.register(Logger.class);
                            ^
  symbol:   class Logger
  location: class ApiClient
Note: /Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/ApiClient.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
10 errors
1 warning
:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.804 secs

sbt test also failed.

Swagger-codegen version

Latest master.

Suggest a Fix

If anyone wants to work on this issue, please reply to let us know and I can show you some good starting points.

@dejan2609
Copy link

@wing328 I'll try to deal with this.

@dejan2609
Copy link

@wing328 it seems that now maven test are failing also; scenario:

  • execute mvn test against current HEAD and receive error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project swagger-petstore-resteasy: Compilation failure: Compilation failure:
[ERROR] C:\Work\IDEA-2017.2\projects\swagger-codegen\samples\client\petstore\java\resteasy\src\main\java\io\swagger\client\api\FakeApi.java:[227,51] error: unmappable character for encoding Cp1252
[ERROR] C:\Work\IDEA-2017.2\projects\swagger-codegen\samples\client\petstore\java\resteasy\src\main\java\io\swagger\client\api\FakeApi.java:[227,61] error: unmappable character for encoding Cp1252

  • test are failing due to characters incompatibility with HEAD encoding (see class io.swagger.client.api.FakeApi):
  /**
   * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 
   * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 
   * @param number None (required)
   * @param _double None (required)
  • (optional/suggested): delete your <userHome>.m2/repository folder content
  • checkout my pull request branch (simple chage: maven compiler plugin encoding is configured to UTF-8 value)
  • execute mvn test and you will receive error:

[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ swagger-petstore-resteasy ---
[INFO] Compiling 50 source files to C:\Work\IDEA-2017.2\projects\swagger-codegen\samples\client\petstore\java\resteasy\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] C:\Work\IDEA-2017.2\projects\swagger-codegen\samples\client\petstore\java\resteasy\src\main\java\io\swagger\client\model\FormatTest.java:[24,22] error: package org.threeten.bp does not exist
[ERROR] C:\Work\IDEA-2017.2\projects\swagger-codegen\samples\client\petstore\java\resteasy\src\main\java\io\swagger\client\model\FormatTest.java:[25,22] error: package org.threeten.bp does not exist
[ERROR] C:\Work\IDEA-2017.2\projects\swagger-codegen\samples\client\petstore\java\resteasy\src\main\java\io\swagger\client\model\FormatTest.java:[60,10] error: cannot find symbol
[ERROR] symbol: class LocalDate
location: class FormatTest
C:\Work\IDEA-2017.2\projects\swagger-codegen\samples\client\petstore\java\resteasy\src\main\java\io\swagger\client\model\FormatTest.java:[63,10] error: cannot find symbol
[ERROR] symbol: class OffsetDateTime
location: class FormatTest
C:\Work\IDEA-2017.2\projects\swagger-codegen\samples\client\petstore\java\resteasy\src\main\java\io\swagger\client\model\FormatTest.java:[243,25] error: cannot find symbol
[ERROR] symbol: class LocalDate
location: class FormatTest

It seems that (at least) this dependency needs to be added:

I'll try to revisit this soon.

@wing328
Copy link
Contributor Author

wing328 commented Sep 24, 2017

I've filed #6556 to fix the maven build error.

I wonder if you can file a PR to fix the same for build.gradle and build.sbt files for Java RESTEasy client.

@dejan2609
Copy link

dejan2609 commented Sep 30, 2017

@wing328 I'll try to change build.gradle and build.sbt.

@wing328 wing328 modified the milestones: Future, v2.3.0 Oct 2, 2017
@wing328 wing328 reopened this Nov 24, 2017
@wing328 wing328 modified the milestones: v2.3.0, Future Nov 29, 2017
@developersteve
Copy link

Getting this error as well during Travis checks

ApiClient.java:22: error: package org.threeten.bp does not exist
import org.threeten.bp.LocalDate;

@wing328
Copy link
Contributor Author

wing328 commented Jan 19, 2018

@dejan2609 @developersteve the issue with build.gradle has been addressed with #7448

Please pull the latest 2.4.0 branch and give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants