How can I parse info from kotlin docs to swagger-ui? - kotlin

I need to parse kotlin docs (not swagger annotation) for swagger-ui.
I tried this, but it don't work.
Here my springdoc dependencies (springdocVersion = "1.6.6"). By the way, I can't use therapi version 0.13.0 if it's important.
runtimeOnly("org.springdoc:springdoc-openapi-kotlin:$springdocVersion")
implementation("org.springdoc:springdoc-openapi-ui:$springdocVersion")
implementation("org.springdoc:springdoc-openapi-webflux-ui:$springdocVersion")
implementation("org.springdoc:springdoc-openapi-javadoc:$springdocVersion")
annotationProcessor("com.github.therapi:therapi-runtime-javadoc-scribe:0.12.0")
implementation("com.github.therapi:therapi-runtime-javadoc:0.12.0")

After I replaced annotationProcessor("com.github.therapi:therapi-runtime-javadoc-scribe:0.12.0") with kapt("com.github.therapi:therapi-runtime-javadoc-scribe:0.12.0"), all worked well!
An example of the build file can be found here

Related

Try to find KotlinToJVMBytecodeCompiler.compileScript method in Kotlin 1.4.10

During migration my java project from Kotlin 1.2 to 1.4 I ran into a problem that there is no such method as KotlinToJVMBytecodeCompiler.compileScript() in v 1.4
Class<?> script = requireNonNull(KotlinToJVMBytecodeCompiler.INSTANCE.compileScript(environment, getClass().getClassLoader()), () -> file + " compilation failed");
Please suggest me what should I replace this with?
Thanks!
I was able to find this removal commit on github https://github.com/JetBrains/kotlin/commit/d863dc04e60ce82a162dbc4b5f1c9d379806177a#diff-36340d5f4473fd26b6fd3d39ac22b10560a53da22b65c763ba0b9e4d9864a18e
Then maybe you can see what you need to do to migrate your code to a new version, if not then maybe raise an issue on github that this public function has been removed without any info how to migrate to something new

Using sun.reflect package with openjdk11

Is there a way to use sun.reflect in OpenJDK11, by maybe adding something in "--add-exports"? Our code fails since a jide pkg internally uses sun.reflect package and I'm trying to see if there's a way to make it work.
I've already tried with the below but that doesn't help.
"--add-exports jdk.unsupported/sun.reflect=ALL-UNNAMED"
Here's the exception, where the underlying class references sun.reflect.Reflection
java.lang.NoClassDefFoundError: sun/reflect/Reflection
I had this problem and fixed it by using a newer version of jide. Changing from jide-whatever:3.2.3 to jide-whatever:3.7.6 was enough to make it work in my case.
If you cannot migrate to newer versions, the solution is to make a wrapper around Throwable().getStackTrace()[n].getClass() and put it in WEB-INF/classes folder
This is simple workaround. It works in many cases.
package sun.reflect;
public class Reflection {
public static Class<?> getCallerClass(int n){
StackTraceElement[] elements = new Throwable().getStackTrace();
return elements[n].getClass() ;
}
}
https://github.com/rafaljot/NoClassDefFoundError-sun-reflect-Reflection
It can be fixed when you update the version of the jars.

Unresolved dependencies de.joergviola#play-pdf_2.10;0.6-SNAPSHOT with Play 2.0 PDF module

I would like to use that module:
Play 2.0 PDF
with my play 2.2.1 application, but unfortunatelly I've got an error:
unresolved dependencies de.joergviola#play-pdf_2.10;0.6-SNAPSHOT: not found
please help, or advice any other pdf library to use.
I would like to generate pdf from html and also from data/code
There is a forked repo that has the following information:
"Currently, the module is hosted at http://alias1.github.io/play2pdf/snapshots/ Therefore, including the following lines in your Build.scala will resolve it:"
val appDependencies = Seq(
...
"de.joergviola" %% "play2pdf_2.10" % "0.6.3-SNAPSHOT"
)
val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
...
resolvers += Resolver.url("play2pdf Repository", url("http://alias1.github.io/play2pdf/snapshots/"))(Resolver.ivyStylePatterns)
)
This may work as a temporary work around for you until you can find a better supported PDF library for Java.

Gradle / Groovy properties

I would like to control 'global' config in Gradle build scripts using external property files on each build machine (dev, ci, uat,...) and specify the filename with a command line argument.
e.g. gradle -DbuildProperties=/example/config/build.properties
I specifically don't want to use gradle.properties as we have existing projects that already use this approach and (for example) we want to be able to amend database urls and jdbc drivers without having to change every project.
So far have tried:-
Properties props = new Properties()
props.load(new FileInputStream("$filename"))
project.setProperty('props', props)
which works but has a deprecated warning, but I can't figure out how to avoid this.
Have also tried using groovy style config files with ConfigSlurper:-
environments {
dev {
db.security {
driver=net.sourceforge.jtds.jdbc.Driver
url=jdbc:someserver://somehost:1234/some_db
username=userId
password=secret
}
}
}
but the colons and forward slashes are causing exceptions and we don't want to have to mess up config with escape characters.
There must be a non-deprecated way to do this - can anyone suggest the 'right' way to do it?
Thanks
You can get rid of the deprecated warning quite easily. The message you got probably looks something like this:
Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "props" on "root project 'private'", value: "true".
It can be fixed by replacing:
project.setProperty('props', props)
with
project.ext.props = props
Just to supplement the response given by #Steinar:
it's still possible to use next syntax:
project.ext.set('prop_name', prop_value)
in case you have several properties from file:
props.each({ project.ext.set(it.key, it.value)} )

Can't use captcha from tomahawk library

I'm trying to use the captcha component from tomahawk, <t:captcha>. Everytime the page loads, the following error appears:
com.sun.facelets.tag.TagException: /tiles/competitionSite.xhtml #112,46 Tag Library supports namespace:
http://myfaces.apache.org/tomahawk, but no tag was defined for name:
captcha
I think there's something wrong with the libraries. I checked the tomahawk JARs and <t:captcha> should be supported in Tomahawk 1.1.7 or higher. I used multiple versions (e.g. 1.1.13), but <t:captcha> never worked. All the other tags like <t:inputText> are working fine. I also imported the batik-awt-util-1.6-1.jar, because that's necessary for captchas.
Maybe there's a problem with my other libraries? I can't exchange them easily, because there are many dependencies. Here's a list of them:
batik-awt-util-1.6-1.jar
commons-beanutils-1.7.0.jar
commons-codec-1.3.jar
commons-collections-3.1.jar
commons-digester-1.6.jar
commons-el-1.0.jar
commons-lang-2.1.jar
commons-validator-2.1.jar
el-ri.jar
jakarta-oro.jar
jboss-serialization.jar
jsf-facelets-1.1.12.jar
jstl-1.1.0.jar
myfaces-api-1.1.5.jar
myfaces-impl-1.1.5.jar
org.springframework.web-3.0.5.jar
richfaces-api-3.1.6.GA.jar
richfaces-impl-3.1.6.GA.jar
richfaces-ui-3.1.6.GA.jar
tomahawk-1.1.13.jar
urlrewrite-2.6.0.jar
Thanks for your help!
I just found the mistake. In our CMS the tomahawk.taglib.xml file will not be deployed dynamically from the included JAR. I just had to create a new entry like this:
<tag>
<tag-name>captcha</tag-name>
<component>
<component-type>org.apache.myfaces.CAPTCHA</component-type>
<renderer-type>org.apache.myfaces.CAPTCHA</renderer-type>
</component>
</tag>
Now I use <t:captcha> with tomahawk-1.1.7.jar and batik-awt-util-1.6-1.jar.