0

I am working with Kotlin and want to do static analysis using Detekt plugin. My problem is, when I want to download it from Maven central repository, it is giving me below error. But when I use company's repository (Nexus), it does not give me any error and downloads it smoothly. I don't understand this.

Can someone tell me why this is happening? I want to use this plugin and have not found out any other alternative.

Below is my error :

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (detekt) on project agathe: Execution detekt of goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run failed: Plugin org.apache.maven.plugins:maven-antrun-plugin:1.8 or one of its dependencies could not be resolved: Could not find artifact com.beust:jcommander:jar:1.74 in central (https://repo.maven.apache.org/maven2) -> [Help 1]

Kindly find my POM file below.

<properties>
    .. 
    <sonar.kotlin.detekt.reportPaths>${project.build.directory}/detekt.xml</sonar.kotlin.detekt.reportPaths>
    ..
</properties>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.8</version>
            <executions>
                <execution>
                    <!-- This can be run separately with mvn antrun:run@detekt -->
                    <id>detekt</id>
                    <phase>verify</phase>
                    <configuration>
                        <target name="detekt">
                            <java taskname="detekt" dir="${basedir}"
                                  fork="true"
                                  failonerror="false"
                                  classname="io.gitlab.arturbosch.detekt.cli.Main"
                                  classpathref="maven.plugin.classpath">
                                <arg value="--input"/>
                                <arg value="${basedir}/src"/>
                                <arg value="--filters"/>
                                <arg value=".*/target/.*,.*/resources/.*"/>
                                <arg value="--report"/>
                                <arg value="xml:${project.build.directory}/detekt.xml"/>
                            </java>
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>io.gitlab.arturbosch.detekt</groupId>
                    <artifactId>detekt-cli</artifactId>
                    <version>1.0.0-RC14</version>
                </dependency>
            </dependencies>
        </plugin>
Radiant
  • 360
  • 3
  • 26
  • The given dependency to jcommander version 1.74 does simply not exist cause the most recent version is 1.71... – khmarbaise Aug 07 '19 at 12:44
  • @khmarbaise but I am not using that plugin anywhere in my POM. I dont know why it is also showing that. – Radiant Aug 07 '19 at 12:45
  • 1
    It is one of your dependencies...it's coming transitively via the `detekt-cli` and it has a simply a wrong version: https://search.maven.org/artifact/io.gitlab.arturbosch.detekt/detekt-cli/1.0.0-RC14/jar – khmarbaise Aug 07 '19 at 13:00
  • @khmarbaise sorry to ask you but could you please tell me what I am doing wrong? I checked above link but did not understand which plugin/dependency i need to put.. – Radiant Aug 07 '19 at 13:25
  • If you are using companies nexus it works you have written...does it define the same version of the artifacts? – khmarbaise Aug 07 '19 at 17:12
  • @khmarbaise..yeah..same version i had..but then i followed your link and somehow it works..i will add solution here..Thanks for the link – Radiant Aug 08 '19 at 06:01
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/197683/discussion-between-ruchir-naphade-and-khmarbaise). – Radiant Aug 08 '19 at 12:20

0 Answers0