swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
17.02k stars 6.03k forks source link

Mvn Package - failed test on initial build #3026

Closed james-willett closed 8 years ago

james-willett commented 8 years ago
Description

I cloned the master branch from Git, and ran Mvn Package . There is a failing test that is causing the build to fail

Swagger-codegen version

Latest from Master branch

... evaluate(io.swagger.codegen.ignore.CodegenIgnoreProcessorTest) Time elapsed: 0.01 sec <<< FAILURE! java.lang.AssertionError: A file when non-matching should allow. expected [true] but found [false] at io.swagger.codegen.ignore.CodegenIgnoreProcessorTest.evaluate(CodegenIgnoreProcessorTest.java:91)

Results :

Failed tests: io.swagger.codegen.ignore.CodegenIgnoreProcessorTest.evaluate(io.swagger.codegen.ignore.CodegenIgnoreProcessorTest) Run 1: PASS Run 2: PASS Run 3: PASS Run 4: CodegenIgnoreProcessorTest.evaluate:91 A file when non-matching should allow. expected [true] but found [false] Run 5: PASS ... Run 25: PASS

Tests run: 477, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] swagger-codegen-project ............................ SUCCESS [ 0.940 s] [INFO] swagger-codegen (core library) ..................... FAILURE [ 16.378 s] [INFO] swagger-codegen (executable) ....................... SKIPPED [INFO] swagger-codegen (maven-plugin) ..................... SKIPPED [INFO] swagger-generator .................................. SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 17.579 s [INFO] Finished at: 2016-06-02T11:06:14+01:00 [INFO] Final Memory: 30M/510M [INFO] ------------------------------------------------------------------------

james-willett commented 8 years ago

I am using Maven 3.3.9 and JDK 1.8.0_65

wing328 commented 8 years ago

It works for me. I'll test it with JDK1.8 in another machine.

For the time being, please try mvn clean package -DskipTests as a workaround.

wing328 commented 8 years ago

Works for me with JDK1.8

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] swagger-codegen-project ........................... SUCCESS [1.589s]
[INFO] swagger-codegen (core library) .................... SUCCESS [21.276s]
[INFO] swagger-codegen (executable) ...................... SUCCESS [5.363s]
[INFO] swagger-codegen (maven-plugin) .................... SUCCESS [3.692s]
[INFO] swagger-generator ................................. SUCCESS [5.947s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 38.352s
[INFO] Finished at: Tue May 31 21:44:37 HKT 2016
[INFO] Final Memory: 46M/415M
[INFO] ------------------------------------------------------------------------
dev01@dev01 swagger-codegen %java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~12.04-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
dev01@dev01 swagger-codegen %

Would you happen to have another machine that you can try?

james-willett commented 8 years ago

Thanks, skipping the tests worked for me - must be something else in my config

LightySnake commented 8 years ago

I have the same error (Run 4: CodegenIgnoreProcessorTest.evaluate:91 A file when non-matching should allow. expected [true] but found [false]) on windows 7 (maven 3.3.9 JDK 1.8.0_91), with mac os x no error.

wing328 commented 8 years ago

@LightySnake thanks for providing more info. I'll look into that tomorrow.

LightySnake commented 8 years ago

Additional info:

mvn --version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: C:\Program Files\Maven\bin\..
Java version: 1.8.0_91, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_91\jre
Default locale: it_IT, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
wing328 commented 8 years ago

@LightySnake thanks for the additional info. Does the workaround mvn clean package -DskipTests work for you in Windows?

LightySnake commented 8 years ago

Yes, the workaround work fine

wing328 commented 8 years ago

@LightySnake thanks for the confirmation. We'll treat this with relatively low priority at the moment since there's a workaround available.

LightySnake commented 8 years ago

@wing328 Thank you for the support

jimschubert commented 8 years ago

@wing328 this is the same issue as #3047, and the test is conditionally skipped by #3067 (already merged).

The problem is that build.sh and Build.sh are the same file on Windows, while they aren't on OS X or Linux. The test didn't previously account for being run on Windows.

wing328 commented 8 years ago

@jimschubert thanks for looking into this. Closing this as the fix (#3067) has been merged into master.

ananastya commented 7 years ago

Hello! I cannot execute command mvn clean package. I cloned repository. I change directory to "swagger-codegen". And execute mvn clean package. But it return errors:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] swagger-codegen-project
[INFO] swagger-codegen (core library)
[INFO] swagger-codegen (executable)
[INFO] swagger-codegen (maven-plugin)
[INFO] swagger-generator
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building swagger-codegen-project 2.2.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ swagger-codegen-project ---
[INFO]
[INFO] --- maven-checkstyle-plugin:2.17:check (validate) @ swagger-codegen-project ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] swagger-codegen-project ............................ FAILURE [ 0.727 s]
[INFO] swagger-codegen (core library) ..................... SKIPPED
[INFO] swagger-codegen (executable) ....................... SKIPPED
[INFO] swagger-codegen (maven-plugin) ..................... SKIPPED
[INFO] swagger-generator .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.280 s
[INFO] Finished at: 2017-07-14T17:15:44+05:00
[INFO] Final Memory: 9M/21M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (validate) on project swagger -codegen-project: Execution validate of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check failed: Plugin org.apache.maven.plugins:maven-checkstyle-plugin:2.17 or one of its dependencies could not be resolved: Could not find a rtifact com.sun:tools:jar:1.7.0 at specified path C:\Program Files (x86)\Java\jre1.8.0_131/../lib/tools.jar -> [Help 1] [ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

Am I doing wrong anything or it's bug?

wing328 commented 7 years ago

@ananastya please open a new issue instead.

ananastya commented 7 years ago

@wing328 sorry, it was my mistake. Installation of java jdk instead of jre solved the issue

wing328 commented 7 years ago

@ananastya np. Open a new issue if you need further help from us.

moballiachi commented 4 years ago

Hi guys, is ti bit late to comment?? lol ;) ... I had the same error and I was be able to fix with changing java version... some case swagger needs a maven version running over java 8 so, to fix please:

sudo yum install java-1.8.0-devel sudo /usr/sbin/alternatives --config java enter number of java 8 in prompted input sudo /usr/sbin/alternatives --config javac enter number of java 8 in prompted input

[INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] swagger-codegen-project ............................ SUCCESS [ 2.274 s] [INFO] swagger-codegen (core library) ..................... SUCCESS [ 55.627 s] [INFO] swagger-codegen (executable) ....................... SUCCESS [ 9.299 s] [INFO] swagger-codegen (maven-plugin) ..................... SUCCESS [ 14.746 s] [INFO] swagger-generator .................................. SUCCESS [ 14.082 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------

check it this [https://docs.aws.amazon.com/neptune/latest/userguide/iam-auth-connect-prerq.html]

enjoy your quarantine