teamcarma / swagger-jaxrs-doclet

This fork is no longer actively maintained, please switch to https://github.com/conorroche/swagger-doclet
Apache License 2.0
81 stars 38 forks source link

Doclet fails when destination directory does not exist #50

Closed alexradzin closed 9 years ago

alexradzin commented 9 years ago

One of parameters supported by javadoc is -d that allows to specify the destination directory. If directory does not exist it is created automatically by javadoc. If specified destination is not a directory the following error is printed:

javadoc: error - Destination directory is not a directory 

Unfortunately ServiceDoclet breaks this functionality: if destination directory does not exist doclet throws the following exception:

javadoc: error - In doclet class com.carma.swagger.doclet.ServiceDoclet,  method start has thrown an exception java.lang.reflect.InvocationTargetException
java.lang.IllegalArgumentException: Path after -d is expected to be a directory!
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:92)
        at com.carma.swagger.doclet.DocletOptions.parse(DocletOptions.java:74)
        at com.carma.swagger.doclet.ServiceDoclet.start(ServiceDoclet.java:20)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:280)
        at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:160)
        at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:397)
        at com.sun.tools.javadoc.Start.begin(Start.java:167)
        at com.sun.tools.javadoc.Main.execute(Main.java:59)
        at com.sun.tools.javadoc.Main.main(Main.java:49)
conorroche commented 9 years ago

fix committed

conorroche commented 9 years ago

@alexradzin can you confirm this works as you expect now?

conorroche commented 9 years ago

closing as I believe this has been resolved