Problems setting up dokka in Maven - maven

I have added the following to my pom.xml, based on this page:
https://github.com/Kotlin/dokka#using-the-maven-plugin
pom.xml
<dependency>
<groupId>org.jetbrains.dokka</groupId>
<artifactId>dokka-maven-plugin</artifactId>
<version>0.9.19-dev-15</version>
</dependency>
<pluginRepositories>
<pluginRepository>
<id>jcenter</id>
<name>JCenter</name>
<url>https://jcenter.bintray.com/</url>
</pluginRepository>
</pluginRepositories>
<plugin>
<groupId>org.jetbrains.dokka</groupId>
<artifactId>dokka-maven-plugin</artifactId>
<version>0.9.19-dev-15</version>
<executions>
<execution>
<phase>pre-site</phase>
<goals>
<goal>dokka</goal>
</goals>
</execution>
</executions>
<configuration>
<dokkaPlugins>
<plugin>
<groupId>org.jetbrains.dokka</groupId>
<artifactId>kotlin-as-java-plugin</artifactId>
<version>0.9.19-dev-15</version>
</plugin>
</dokkaPlugins>
</configuration>
</plugin>
When I run the project, I get the following errors:
Dependency 'org.jetbrains.dokka:dokka-maven-plugin:0.9.19-dev-15' not found
Plugin 'org.jetbrains.dokka:dokka-maven-plugin:0.9.19-dev-15' not found
Can someone help out with this configuration? Thanks in advance.

For this version add the Kotlin Dev Maven repository to you project:
<repositories>
<repository>
<id>k-dev</id>
<name>K-dev</name>
<url>https://dl.bintray.com/kotlin/kotlin-dev/</url>
</repository>
</repositories>
You can see the URL of the repository for this library page on the Maven central:
Note: this artifact is located at Kotlin Dev repository (https://dl.bintray.com/kotlin/kotlin-dev/)

Related

How to configure Android Studio to include configuration folder containing pom.xml in project?

I am trying to setup a TeamCity "project configuration as code" using Kotlin DSL https://blog.jetbrains.com/teamcity/2019/03/configuration-as-code-part-1-getting-started-with-kotlin-dsl/
I've created a sample project in TeamCity pointing to just an empty Android Studio project with empty Activity which I 've published in the Github. I've enabled Kotlin DSL configuration in the TeamCity GUI for that project.
After that TeamCity has commited a .teamcity folder to my Android Studio project via Git containing pom.xml. This folder is a top project folder and resides in the root along with the app module. However, when I am inspecting the code in settings.kts the IDE is not giving me any hints. I cannot use the autocompletion for the Kotlin DSL configuration code, I don't have any special formatting or code time lint checks in my IDE
I was trying to follow the above mentioned blog guidance but unfortunately I cannot right-click on the pom.xml file and don't see any option to Add as Mavenin Android Studio.
In addition I cannot see any External Libraries being added to my project related to TeamCity DSL which of course means that the dependencies from pom.xml file were not handled.
I am using Android Studio 4.0
This is a pom.xml which TeamCity added to my Android Studio project (under .teamcity folder):
<?xml version="1.0"?>
<project>
<modelVersion>4.0.0</modelVersion>
<name>KotlinTeamcityDSL Config DSL Script</name>
<groupId>KotlinTeamcityDSL</groupId>
<artifactId>KotlinTeamcityDSL_dsl</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<repositories>
<repository>
<id>jetbrains-all</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>teamcity-server</id>
<url>http://localhost:8111/app/dsl-plugins-repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>JetBrains</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>${basedir}</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<configuration/>
<executions>
<execution>
<id>compile</id>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>process-test-sources</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>teamcity-configs-maven-plugin</artifactId>
<version>${teamcity.dsl.version}</version>
<configuration>
<format>kotlin</format>
<dstDir>target/generated-configs</dstDir>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin</artifactId>
<version>${teamcity.dsl.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin-plugins</artifactId>
<version>1.0-SNAPSHOT</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-script-runtime</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Can you please help me how I should properly setup this pom.xml configuration to be usable in Android Studio? Android Studio project uses Gradle by default

Dependencies work fine in maven but not in sbt

In my scala project I have a dependency that works fine in my maven project, but throws an error in my sbt project.
In this specific case the dependency in my build.sbt is:
"com.sksamuel.elastic4s" % "elastic4s-xpack-security_2.11" % "5.1.5"
while in my pom.xml:
[...]
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<encoding>UTF-8</encoding>
<scala.version>2.11.8</scala.version>
<scala.compat.version>2.11</scala.compat.version>
<spark.version>2.1.0</spark.version>
</properties>
[...]
<repositories>
<repository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
<repository>
<id>elasticsearch-releases</id>
<url>https://artifacts.elastic.co/maven</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>com.sksamuel.elastic4s</groupId>
<artifactId>elastic4s-xpack-security_${scala.compat.version}</artifactId>
<version>5.1.5</version>
</dependency>
[...]
and the error shown is:
[trace] Stack trace suppressed: run 'last *:update' for the full output.
[trace] Stack trace suppressed: run 'last *:ssExtractDependencies' for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: org.elasticsearch.client#x-pack-transport;5.1.1: not found
[error] (*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: org.elasticsearch.client#x-pack-transport;5.1.1: not found
[error] Total time: 13 s, completed Mar 1, 2017 4:40:59 PM</pre><br/>See complete log in /Users/salvob/Library/Logs/IdeaIC2016.3/sbt.last.log
in fact the dependency doesn't exist.
But my question here is: Why in maven this issue doesn't show up? What does happen in maven that it doesn't in SBT ?
Add to build.sbt:
resolvers in ThisBuild += "elastic" at "https://artifacts.elastic.co/maven"
See Elastic documentation for gradle:
// Add the Elasticsearch Maven Repository
maven {
url "https://artifacts.elastic.co/maven"
}

How do I include a Maven plugin from a local repository?

I have a custom plugin that compresses files that I need to include in my maven build. So I have included this plugin in my pom.xml:
<build>
// Other tags
<plugin>
<groupId>someGroupId</groupId>
<artifactId>somePlugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Since it is a custom plugin, it is not available in any public Maven repository. So whenever I try to build, I get an error message saying:
Failed to read artifact .....
even though I have added it to my local repository. How can I refer to this plugin that is in my local repository?
If you mean local repository in the classic sense, make sure that you installed your plugin jar correctly. Install it to your local repository again with the following command:
mvn install:install-file -Dfile=/some/path/somePlugin.jar -DgroupId=someGroupId -DartifactId=somePlugin -Dversion=1.0.0 -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true
You should then be able to use your plugin in your Maven build.
If you mean local in the sense of some locally hosted repository, you need to specify the repository containing your artifact as a pluginRepository. Add the following to the top level of your pom.xml:
<pluginRepositories>
<pluginRepository>
<id>some-repo</id>
<name>Some Repository</name>
<url>http://some.host/some/path</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

maven does not change the snapshot jar file in local repository

We config jfrog artifactory successfully and create a pom.xml to build and deploy our basic jar files into it as snapshot. then we configure another project to get those jar files from repository and it did successfully too, then we try to change basic libraries and deploy it again as the same snapshot name, and it did correctly but when we want to get those libraries again, maven does not change the basic libraries in local repository, unless we change the version of the snapshot but we don't want to do it.
deploy pom.xml configuration file
<plugin>
<groupId>org.jfrog.buildinfo</groupId>
<artifactId>artifactory-maven-plugin</artifactId>
<version>2.2.2</version>
<inherited>false</inherited>
<executions>
<execution>
<id>build-info</id>
<goals>
<goal>publish</goal>
</goals>
<configuration>
<deployProperties>
<gradle>awesome</gradle>
</deployProperties>
<artifactory>
<includeEnvVars>true</includeEnvVars>
<timeoutSec>60</timeoutSec>
<propertiesFile>publish.properties</propertiesFile>
</artifactory>
<publisher>
<contextUrl>{{ARTIFACTORY_CONTEXT_URL|"http://tls.local:9081/artifactory"}}</contextUrl>
<username>admin</username>
<password>AP5PqkrxgwKVMBeY6wxPYr66R3M</password>
<excludePatterns>*-tests.jar</excludePatterns>
<repoKey>libs-release-local</repoKey>
<snapshotRepoKey>libs-snapshot-local</snapshotRepoKey>
</publisher>
<buildInfo>
<buildName>plugin-demo</buildName>
<buildNumber>{{DRONE_BUILD_NUMBER|TRAVIS_BUILD_NUMBER|CI_BUILD_NUMBER|BUILD_NUMBER}}
</buildNumber>
<buildUrl>{{DRONE_BUILD_URL|CI_BUILD_URL|BUILD_URL}}</buildUrl>
</buildInfo>
<licenses>
<autoDiscover>true</autoDiscover>
<includePublishedArtifacts>false</includePublishedArtifacts>
<runChecks>true</runChecks>
<scopes>compile,runtime</scopes>
<violationRecipients>build#organisation.com</violationRecipients>
</licenses>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
third party pom.xml configuration file:
<repository>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://tls.local:9081/artifactory/libs-snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
How can we achieve our goal?
first we must configure our jfrog repository's maven snapshot version behavior to unique and check handle releases and handle snapshot and then delete completely our local repository's snapshot

Error when when generating Doxygen documentation with the Doxygen maven plugin

I am trying to use the Maven Doxygen Plugin. I added that in the pom.xml of my project:
<reporting>
<plugins>
<plugin>
<groupId>net.sf.doodleproject</groupId>
<artifactId>doxygen-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
</plugins>
</reporting>
<pluginRepositories>
<pluginRepository>
<id>doodleproject-repo</id>
<name>DoodleProject Maven 2 Repository</name>
<url>http://doodleproject.sourceforge.net/maven2/release</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
And I launch the command:
mvn -X net.sf.doodleproject:doxygen-maven-plugin:report
And I have this error:
[ERROR] Failed to execute goal net.sf.doodleproject:doxygen-maven-plugin:2.2:report (default-cli) on project project: An error has occurred in Doxygen report generation.
Failed to generate Doxygen documentation. -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException:
Failed to execute goal net.sf.doodleproject:doxygen-maven-plugin:2.2:report (default-cli) on project amc: An error has occurred in Doxygen report generation.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
Caused by: org.apache.maven.plugin.MojoExecutionException: An error has occurred in Doxygen report generation.
at org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:83)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
Caused by: org.apache.maven.reporting.MavenReportException: Failed to generate Doxygen documentation.
at net.sf.doodleproject.mavenite.doxygen.DoxygenReport.executeReport(DoxygenReport.java:299)
at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:131)
Doxygen is working well when I use it on my project without the maven plugin.
There is something else to do to use the plugin?
Thanks for your help,
I tried with another plugin: com.soebes.maven.plugins.dmg and it's working.
My pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>com.soebes.maven.plugins.dmg</groupId>
<artifactId>doxygen-maven-plugin</artifactId>
<configuration>
<projectName>${project.artifactId}</projectName>
<projectNumber>${project.version}</projectNumber>
<optimizeOutputJava>true</optimizeOutputJava>
<extractAll>true</extractAll>
<extractStatic>true</extractStatic>
<recursive>true</recursive>
<exclude>.git</exclude>
<recursive>true</recursive>
<umlLook>true</umlLook>
<haveGraph>true</haveGraph>
<generateLatex>false</generateLatex>
<generateHtml>true</generateHtml>
<outputDirectory>${basedir}/doxygen_doc</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>doodleproject-repo</id>
<name>DoodleProject Maven 2 Repository</name>
<url>http://doodleproject.sourceforge.net/maven2/release</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
Try this plugin. Worked great for me:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<failOnError>false</failOnError>
</configuration>
</plugin>

Resources