I have disabled all of the plugins in my module's pom.xml file and in the parent pom.xml file. I type
`mvn clean install -U`
and in the same directory
`${project.basedir}/src/main/site/resources/repo`
appears, approximately during the time the compile phase executes.
Any ideas about what could be causing this?
Edit:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>My Project</name>
<groupId>com.my</groupId>
<artifactId>my.parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>openid-connect-client</module>
<module>openid-connect-common</module>
<module>openid-connect-server</module>
<module>my.libraries</module>
<module>my.rest</module>
<module>my.spark-utils</module>
<module>openid-connect-server-webapp</module>
</modules>
<repositories>
<repository>
<id>HortonWorks</id>
<url>http://nexus-private.hortonworks.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.basedir>.</project.basedir>
<java.version>1.8</java.version>
<scala.tools.version>2.11</scala.tools.version>
<scala-version>${scala.tools.version}.7</scala-version>
<flyway.maven.plugin.version>4.2.0</flyway.maven.plugin.version>
<maven.war.plugin.version>3.2.2</maven.war.plugin.version>
<maven.install.plugin.version>2.5.2</maven.install.plugin.version>
<sonar.jacoco.reportPaths>
target/coverage-reports/jacoco-ut.exec,target/coverage-reports/jacoco-it.exec
</sonar.jacoco.reportPaths>
<sonar.junit.reportPaths>target/surefire-reports</sonar.junit.reportPaths>
<findbugs.annotations.version>3.0.1</findbugs.annotations.version>
<findbugs.jsr305.version>3.0.2</findbugs.jsr305.version>
<scapegoat.version>1.3.5</scapegoat.version>
<apached.server.jndi.version>1.5.5</apached.server.jndi.version>
<aws-java-sdk.version>1.11.250</aws-java-sdk.version>
<!-- Commons -->
<commons-collections4.version>4.1</commons-collections4.version>
<commons.csv.version>1.1</commons.csv.version>
<commons.fileupload.version>1.3.3</commons.fileupload.version>
<commons.lang3.version>3.5</commons.lang3.version>
<elasticsearch.version>6.2.3</elasticsearch.version>
<elasticsearch.transport.client.version>6.2.3</elasticsearch.transport.client.version>
<lucene.version>7.3.1</lucene.version>
<h2.version>1.4.192</h2.version>
<jboss.logging.version>3.3.1.Final</jboss.logging.version>
<jsoup.version>1.11.2</jsoup.version>
<jmockit.version>1.38</jmockit.version>
<jetty.version>9.4.14.v20181114</jetty.version>
<sonar.scoverage.reportPath>target/scoverage.xml</sonar.scoverage.reportPath>
<sonar.scala.scoverage.reportPath>${sonar.scoverage.reportPath}</sonar.scala.scoverage.reportPath>
<sonar.scala.scapegoat.reportPath>./target/scapegoat</sonar.scala.scapegoat.reportPath>
<sonar.scala.version>${scala-version}</sonar.scala.version>
<!-- Guava -->
<guava.version>22.0</guava.version>
<!-- Snappy -->
<snappy.version>1.0.5</snappy.version>
<!-- Spring -->
<spring.boot.version>1.5.14.RELEASE</spring.boot.version>
<spring.oauth2.version>2.1.0.RELEASE</spring.oauth2.version>
<spring.security.core>4.2.2.RELEASE</spring.security.core>
<spring.security.ldap.version>4.2.2.RELEASE</spring.security.ldap.version>
<spring.version>4.3.7.RELEASE</spring.version>
<!-- Hortonworks Ecosystem -->
<hdp.version>3.0.1.0-187</hdp.version>
<hadoop.version>3.1.1.${hdp.version}</hadoop.version>
<hbase.version>2.0.0.${hdp.version}</hbase.version>
<phoenix.version>5.0.0.${hdp.version}</phoenix.version>
<spark.version>2.3.1.${hdp.version}</spark.version>
<zookeeper.version>3.4.6.${hdp.version}</zookeeper.version>
<!-- Spark Variant -->
<!--<aehrc.variant.spark.version>0.2.0-a1</aehrc.variant.spark.version>-->
<aehrc.variant.spark.version>0.2.0-SNAPSHOT</aehrc.variant.spark.version>
<org.slf4j-version>1.7.25</org.slf4j-version>
</properties>
<profiles>
<!-- Environment Profiles -->
<profile>
<id>local</id>
<properties>
<activatedProfile>local</activatedProfile>
<!-- TODO: For all other env these will be stored on disk -->
<database.url>jdbc:postgresql://localhost:5432/my</database.url>
<database.user>username</database.user>
<database.password>password</database.password>
<postgresql.version>9.4-1200-jdbc41</postgresql.version>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>aws-dev</id>
<properties>
<activatedProfile>aws-dev</activatedProfile>
<!-- TODO: For all other env these will be stored on disk -->
<database.url>
jdbc:postgresql://hostname:5432/db
</database.url>
<database.user>user</database.user>
<database.password>password</database.password>
<postgresql.version>9.4-1200-jdbc41</postgresql.version>
</properties>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
</profile>
<profile>
<id>integration</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!-- -Dtests.security.manager=false is needed otherwise the ESTestCase fails to initialize -->
<configuration>
<!--<argLine>-Xms128m -Xmx512m -Dtests.security.manager=false</argLine>-->
<argLine>${surefireArgLine}</argLine>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>test</goal>
</goals>
<phase>integration-test</phase>
<configuration>
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>sonar</id>
<build>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!-- This plugin compiles Scala files -->
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<!-- The configuration is not included unless the profile is active. -->
<!-- This keeps the compiler plugin out of the equation and assists IntelliJ -->
<!-- as long as IntelliJ doesn't try to activate the sonar profile. -->
<configuration>
<scalaVersion>${scala.tools.version}</scalaVersion>
<args>
<arg>-P:scapegoat:dataDir:${sonar.scala.scapegoat.reportPath}
</arg>
<arg>-P:scapegoat:reportOnly:true</arg>
<arg>
-P:scapegoat:overrideLevels:TraversableHead=Warning:TraversableLast=Warning:OptionGet=Warning:MapGetAndGetOrElse=Warning
</arg>
</args>
<compilerPlugins>
<compilerPlugin>
<groupId>com.sksamuel.scapegoat</groupId>
<artifactId>scalac-scapegoat-plugin_${scala.tools.version}
</artifactId>
<version>${scapegoat.version}</version>
</compilerPlugin>
</compilerPlugins>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
<dependencyManagement>
<dependencies>
...
</dependencies>
</dependencyManagement>
<dependencies>
...
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
</plugin>
<plugin>
<groupId>org.scoverage</groupId>
<artifactId>scoverage-maven-plugin</artifactId>
<version>1.3.0</version>
<configuration>
<highlighting>true</highlighting>
<scalaVersion>${scala.tools.version}</scalaVersion>
</configuration>
<executions>
<execution>
<id>instrument</id>
<goals>
<goal>pre-compile</goal>
<goal>post-compile</goal>
</goals>
</execution>
<execution>
<id>scoverage-report</id>
<goals>
<goal>report</goal>
</goals>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<!-- This plugin compiles Scala files -->
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.3.2</version>
<executions>
<execution>
<id>add-scala-source</id>
<goals>
<goal>add-source</goal>
</goals>
</execution>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>3.0.5</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.21.0</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>${maven.install.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.plugin.version}</version>
<configuration>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>${flyway.maven.plugin.version}</version>
<configuration>
<baselineOnMigrate>true</baselineOnMigrate>
<url>${database.url}</url>
<user>${database.user}</user>
<password>${database.password}</password>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<systemProperties>
<spring.profiles.active>${activatedProfile}</spring.profiles.active>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>com.github.alexcojocaru</groupId>
<artifactId>elasticsearch-maven-plugin</artifactId>
<!-- REPLACE THE FOLLOWING WITH THE PLUGIN VERSION YOU NEED -->
<version>6.0</version>
<configuration>
<!-- REPLACE THE FOLLOWING WITH THE ELASTICSEARCH VERSION YOU NEED -->
<version>${elasticsearch.version}</version>
<clusterName>test</clusterName>
<!--These ports must also be changed in "classpath:test/application.properties".-->
<transportPort>9301</transportPort>
<httpPort>9201</httpPort>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.14.v20181114</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
</plugin>
<plugin>
<groupId>org.appfuse.plugins</groupId>
<artifactId>warpath-maven-plugin</artifactId>
<version>3.5.0</version>
</plugin>
<plugin>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-maven-plugin</artifactId>
<version>1.8.0</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-extensions</artifactId>
<version>1.8.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.1</version>
<executions>
<!--
Prepares the property pointing to the JaCoCo runtime agent which
is passed as VM argument when Maven the Surefire plugin is executed.
-->
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>./target/coverage-reports/jacoco-ut.exec
</destFile>
<!--
Sets the name of the property containing the settings
for JaCoCo runtime agent.
-->
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<!--
Ensures that the code coverage report for unit tests is created after
unit tests have been run.
-->
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<dataFile>./target/coverage-reports/jacoco-ut.exec
</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>./target/site/jacoco-ut
</outputDirectory>
</configuration>
</execution>
<execution>
<id>pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>./target/coverage-reports/jacoco-it.exec
</destFile>
<!--
Sets the name of the property containing the settings
for JaCoCo runtime agent.
-->
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<!--
Ensures that the code coverage report for integration tests after
integration tests have been run.
-->
<execution>
<id>post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<dataFile>./target/coverage-reports/jacoco-it.exec
</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>./target/site/jacoco-it
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-requirements</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>[3.5.3,)</version>
</requireMavenVersion>
<requireJavaVersion>
<version>[${java.version},)</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>
The child pom:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.my</groupId>
<artifactId>my.parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>my.spark-utils</artifactId>
<name>SPARK-UTILS</name>
<packaging>jar</packaging>
<properties>
<scala.override.version>2.11.7</scala.override.version>
<guava.override.version>13.0.1</guava.override.version>
<jetty.override.version>9.3.19.v20170502</jetty.override.version>
</properties>
<profiles>
<profile>
<id>sonar</id>
<build>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.scoverage</groupId>
<artifactId>scoverage-maven-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<configuration>
<scalaVersion>${scala.tools.version}</scalaVersion>
<args>
<arg>-P:scapegoat:dataDir:./target/scapegoat-report</arg>
<arg>-P:scapegoat:reportOnly:true</arg>
<arg>-P:scapegoat:overrideLevels:TraversableHead=Warning:TraversableLast=Warning:OptionGet=Warning:MapGetAndGetOrElse=Warning</arg>
</args>
<compilerPlugins>
<compilerPlugin>
<groupId>com.sksamuel.scapegoat</groupId>
<artifactId>scalac-scapegoat-plugin_${scala.tools.version}</artifactId>
<version>${scapegoat.version}</version>
</compilerPlugin>
</compilerPlugins>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
<dependencies>
...
</dependencies>
<build>
<plugins>
<!-- This plugin compiles Scala files -->
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
</plugin>
<!-- This plugin compiles Java files -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<!-- Maven Shade Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<minimizeJar>true</minimizeJar>
<relocations>
<relocation>
<pattern>it.unimi.dsi.fastutil</pattern>
<shadedPattern>my.it.unimi.dsi.fastutil</shadedPattern>
</relocation>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>my.com.google</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/license/**</exclude>
<exclude>META-INF/*</exclude>
<exclude>META-INF/maven/**</exclude>
<exclude>LICENSE</exclude>
<exclude>NOTICE</exclude>
<exclude>/*.txt</exclude>
<exclude>build.properties</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin>
</plugins>
<finalName>my-spark-utils</finalName>
</build>
I don't have enough space to include all of the dependency information.
I was trying to build the milo master project in eclipse. I did a maven build as suggested by various people online. But every time a do the maven build I am getting a build error stating it requires a goal. Can anyone let me know whats wrong with the build.
Here is the console error:
[ERROR] No goals have been specified for this build. You must specify
a valid lifecycle phase or a goal in the format :
or :[:]:.
Available lifecycle phases are: validate, initialize,
generate-sources, process-sources, generate-resources,
process-resources, compile, process-classes, generate-test-sources,
process-test-sources, generate-test-resources, process-test-resources,
test-compile, process-test-classes, test, prepare-package, package,
pre-integration-test, integration-test, post-integration-test, verify,
install, deploy, pre-clean, clean, post-clean, pre-site, site,
post-site, site-deploy. -> [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/NoGoalSpecifiedException
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
And here is the POM file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.milo</groupId>
<artifactId>milo</artifactId>
<version>0.2.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Eclipse Milo - OPC-UA (IEC 62541)</name>
<description>An open source implementation of OPC-UA (IEC 62541).</description>
<url>https://github.com/eclipse/milo</url>
<scm>
<url>https://github.com/eclipse/milo</url>
<connection>scm:git:git://github.com/eclipse/milo.git</connection>
<developerConnection>scm:git:git#github.com:eclipse/milo.git</developerConnection>
<tag>HEAD</tag>
</scm>
<developers>
<developer>
<id>kevinherron</id>
<name>Kevin Herron</name>
<email>kevinherron#gmail.com</email>
</developer>
</developers>
<licenses>
<license>
<name>Eclipse Public License 1.0</name>
<url>https://eclipse.org/org/documents/epl-v10.php</url>
<distribution>repo</distribution>
</license>
<license>
<name>Eclipse Distribution License 1.0</name>
<url>https://eclipse.org/org/documents/edl-v10.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<modules>
<module>build-tools</module>
<module>milo-examples</module>
<module>opc-ua-stack</module>
<module>opc-ua-sdk</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<prerequisites>
<maven>3.0.5</maven>
</prerequisites>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<configuration>
<failOnError>false</failOnError>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<extensions>false</extensions>
<inherited>true</inherited>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>javadoc-and-source</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<failOnError>false</failOnError>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<configuration>
<configLocation>milo/checkstyle.xml</configLocation>
<excludes>
**/Ua*Loader*,
**/org/eclipse/milo/opcua/stack/core/types/structured/*,
**/org/eclipse/milo/opcua/stack/core/types/enumerated/*,
**/org/eclipse/milo/opcua/sdk/core/CefactEngineeringUnits.java,
**/org/eclipse/milo/opcua/sdk/client/model/nodes/objects/*,
**/org/eclipse/milo/opcua/sdk/client/model/nodes/variables/*,
**/org/eclipse/milo/opcua/sdk/client/model/types/objects/*,
**/org/eclipse/milo/opcua/sdk/client/model/types/variables/*,
**/org/eclipse/milo/opcua/sdk/server/model/nodes/objects/*,
**/org/eclipse/milo/opcua/sdk/server/model/nodes/variables/*,
**/org/eclipse/milo/opcua/sdk/server/model/types/objects/*,
**/org/eclipse/milo/opcua/sdk/server/model/types/variables/*,
**/org/eclipse/milo/opcua/stack/core/Identifiers.java,
**/org/eclipse/milo/opcua/stack/core/types/builtin/unsigned/*,
**/org/eclipse/milo/opcua/stack/core/StatusCodes.java,
**/org/opcfoundation/opcua/binaryschema/*
</excludes>
</configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>7.1.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.milo</groupId>
<artifactId>build-tools</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.21</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<configLocation>milo/checkstyle.xml</configLocation>
<excludes>
**/Ua*Loader*,
**/org/eclipse/milo/opcua/stack/core/types/structured/*,
**/org/eclipse/milo/opcua/stack/core/types/enumerated/*,
**/org/eclipse/milo/opcua/sdk/core/CefactEngineeringUnits.java,
**/org/eclipse/milo/opcua/sdk/client/model/nodes/objects/*,
**/org/eclipse/milo/opcua/sdk/client/model/nodes/variables/*,
**/org/eclipse/milo/opcua/sdk/client/model/types/objects/*,
**/org/eclipse/milo/opcua/sdk/client/model/types/variables/*,
**/org/eclipse/milo/opcua/sdk/server/model/nodes/objects/*,
**/org/eclipse/milo/opcua/sdk/server/model/nodes/variables/*,
**/org/eclipse/milo/opcua/sdk/server/model/types/objects/*,
**/org/eclipse/milo/opcua/sdk/server/model/types/variables/*,
**/org/eclipse/milo/opcua/stack/core/Identifiers.java,
**/org/eclipse/milo/opcua/stack/core/types/builtin/unsigned/*,
**/org/eclipse/milo/opcua/stack/core/StatusCodes.java,
**/org/opcfoundation/opcua/binaryschema/*
</excludes>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<failOnViolation>true</failOnViolation>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
<executions>
<!-- Replacing default-compile as it is treated specially by maven -->
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
<!-- Replacing default-testCompile as it is treated specially by maven -->
<execution>
<id>default-testCompile</id>
<phase>none</phase>
</execution>
<execution>
<id>java-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>java-test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>generate-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<supportedProjectTypes>
<supportedProjectType>jar</supportedProjectType>
<supportedProjectType>bundle</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Import-Package>
com.sun.management.*;resolution:=optional,
!javax.annotation.*,
*
</Import-Package>
</instructions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<goals>deploy</goals>
<tagNameFormat>v#{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<configuration>
<configLocation>milo/checkstyle.xml</configLocation>
<excludes>
**/Ua*Loader*,
**/org/eclipse/milo/opcua/stack/core/types/structured/*,
**/org/eclipse/milo/opcua/stack/core/types/enumerated/*,
**/org/eclipse/milo/opcua/sdk/client/api/model/nodes/objects/*,
**/org/eclipse/milo/opcua/sdk/client/api/model/nodes/variables/*,
**/org/eclipse/milo/opcua/sdk/client/api/model/types/objects/*,
**/org/eclipse/milo/opcua/sdk/client/api/model/types/variables/*,
**/org/eclipse/milo/opcua/sdk/server/model/nodes/objects/*,
**/org/eclipse/milo/opcua/sdk/server/model/nodes/variables/*,
**/org/eclipse/milo/opcua/sdk/server/model/types/objects/*,
**/org/eclipse/milo/opcua/sdk/server/model/types/variables/*,
**/org/eclipse/milo/opcua/stack/core/Identifiers.java,
**/org/eclipse/milo/opcua/stack/core/types/builtin/unsigned/*,
**/org/eclipse/milo/opcua/stack/core/StatusCodes.java
</excludes>
</configuration>
</plugin>
</plugins>
</reporting>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</project>
From the root of the project, try running mvn clean install.
It sounds like you're just running mvn and expecting something to happen.
I have added a custom PMD rule using official documentation (http://pmd.sourceforge.net/pmd-5.1.0/howtowritearule.html)
Rule:
package com.comp.www.lty.awards.service.pmd;
import net.sourceforge.pmd.lang.ast.*;
import net.sourceforge.pmd.lang.java.ast.*;
import net.sourceforge.pmd.lang.java.rule.*;
public class WhileLoopsMustUseBracesRule extends AbstractJavaRule {
public Object visit(ASTWhileStatement node, Object data) {
Node firstStmt = node.jjtGetChild(1);
if (!hasBlockAsFirstChild(firstStmt)) {
addViolation(data, node);
}
return super.visit(node,data);
}
private boolean hasBlockAsFirstChild(Node node) {
return (node.jjtGetNumChildren() != 0 && (node.jjtGetChild(0) instanceof ASTBlock));
}
}
This is my ruleset xml file:
<?xml version="1.0"?>
<ruleset name="My custom rules"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>While loop desc</description>
<rule name="WhileLoopsMustUseBracesRule"
message="Avoid using 'while' statements without curly braces"
class="com.comp.www.lty.awards.service.pmd.WhileLoopsMustUseBracesRule">
<description>
Avoid using 'while' statements without using curly braces
</description>
<priority>3</priority>
<example>
<![CDATA[
public void doSomething() {
while (true)
x++;
}
]]>
</example>
</rule>
</ruleset>
I am using mvn to run these pmd rules. Works fine when I try to use existing rules from pmd jar, but whenever I try to use my above custom rule, I am getting ClassNotFoundException.
Stacktrace:
java.lang.ClassNotFoundException: com.comp.www.lty.awards.service.pmd.WhileLoopsMustUseBracesRule
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at net.sourceforge.pmd.RuleSetFactory.parseSingleRuleNode(RuleSetFactory.java:377)
at net.sourceforge.pmd.RuleSetFactory.parseRuleNode(RuleSetFactory.java:291)
at net.sourceforge.pmd.RuleSetFactory.parseRuleSetNode(RuleSetFactory.java:242)
at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:176)
at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:171)
at net.sourceforge.pmd.RuleSetFactory.parseRuleSetReferenceNode(RuleSetFactory.java:331)
at net.sourceforge.pmd.RuleSetFactory.parseRuleNode(RuleSetFactory.java:289)
at net.sourceforge.pmd.RuleSetFactory.parseRuleSetNode(RuleSetFactory.java:242)
at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:176)
at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:171)
at net.sourceforge.pmd.RuleSetFactory.createRuleSets(RuleSetFactory.java:135)
at net.sourceforge.pmd.RuleSetFactory.createRuleSets(RuleSetFactory.java:119)
at net.sourceforge.pmd.RulesetsFactoryUtils.getRuleSets(RulesetsFactoryUtils.java:31)
at net.sourceforge.pmd.processor.AbstractPMDProcessor.createRuleSets(AbstractPMDProcessor.java:54)
at net.sourceforge.pmd.processor.MultiThreadProcessor.processFiles(MultiThreadProcessor.java:38)
at net.sourceforge.pmd.PMD.processFiles(PMD.java:352)
at org.apache.maven.plugin.pmd.PmdReport.executePmd(PmdReport.java:377)
at org.apache.maven.plugin.pmd.PmdReport.executePmdWithClassloader(PmdReport.java:280)
at org.apache.maven.plugin.pmd.PmdReport.canGenerateReport(PmdReport.java:254)
at org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:119)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:365)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:199)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Although not an ideal solution, but even I spent time to include this custom rule class file in the pmd jar (Custom Java PMD rule: Can't find the class CustomRule), but that didn't help either.
pom.xml:
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.springframework.boot
spring-boot-starter-parent
1.4.0.RELEASE
lty-awards-service
com.comp.www
war
lty-awards-service
Spring Boot Service Sample
1.0-SNAPSHOT
http://maven.apache.org
1.8
<findbugs-maven-plugin.version>3.0.3</findbugs-maven-plugin.version>
<findbugs.include.filter.location>buildtools/findbugs/include.xml</findbugs.include.filter.location>
<findbugs.exclude.filter.location>buildtools/findbugs/exclude.xml</findbugs.exclude.filter.location>
<maven-pmd-plugin.version>3.5</maven-pmd-plugin.version>
<pmd.version>5.3.2</pmd.version>
<pmdRule.version>5.1.0</pmdRule.version>
<pmd.ruleset.location>buildtools/pmd-rules/ltyawardsservicepmd.xml</pmd.ruleset.location>
<pmd.skip>false</pmd.skip>
<pmd.typeResolution>true</pmd.typeResolution>
<!-- spring boot -->
<debug.port>5000</debug.port>
<run.jvmArguments>-Dspring.profiles.active=dev -Dapplication.home=. -Dapplication.name=${project.name}
-Dapplication.environment=dev -Dproject.name=${project.name} -Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=${debug.port}
</run.jvmArguments>
<error-inspector.version>0.1.9</error-inspector.version>
<platform-diagnostics.version>0.0.43</platform-diagnostics.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Camden.SR6</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>${pmdRule.version}</version>
<scope>system</scope>
<systemPath>/Users/babu/.m2/repository/net/sourceforge/pmd/pmd/5.1.0/test.jar</systemPath>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.comp.prime.errorcatalog</groupId>
<artifactId>error-inspector</artifactId>
<version>${error-inspector.version}</version>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/error-inspect</outputDirectory>
<destFileName>inspect.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>com.comp.www.platform</groupId>
<artifactId>platform-diagnostics-main</artifactId>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/error-inspect/lib</outputDirectory>
<destFileName>platform-diagnostics-main.jar</destFileName>
</artifactItem>
</artifactItems>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<message>.*** ERROR: Detected Maven version ${maven.version}, We need Maven 3.0.3 or
higher ***.
</message>
<version>[3.0.3,)</version>
</requireMavenVersion>
<requireJavaVersion>
<message>.*** ERROR: Detected JDK version ${java.version}, We need JDK
${project.jdk.version} or higher ***.
</message>
<version>${project.jdk.version}</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
<execution>
<id>enforce-dont-exist</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireFilesDontExist>
<files>
<file>${project.basedir}/src/main/scala</file>
</files>
</requireFilesDontExist>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${project.jdk.version}</source>
<target>${project.jdk.version}</target>
<encoding>UTF-8</encoding>
</configuration>
<version>3.3</version>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin.version}</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<scalaCompatVersion>${scala.major.minor.version}</scalaCompatVersion>
<jvmArgs>
<jvmArg>-Xms512m</jvmArg>
<jvmArg>-Xmx2048m</jvmArg>
</jvmArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${maven-pmd-plugin.version}</version>
<dependencies>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
<version>${pmd.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-java</artifactId>
<version>${pmd.version}</version>
</dependency>
<dependency>
<groupId>WhileLoopsMustUseBracesRule</groupId>
<artifactId>pmd.ruleset</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>/Users/babu/Downloads/cache.jar</systemPath>
</dependency>
<dependency>
<groupId>com.comp.www.platform</groupId>
<artifactId>platform-build-tools</artifactId>
<version>${platform-build-tools.version}</version>
</dependency>
</dependencies>
<configuration>
<targetJdk>${project.jdk.version}</targetJdk>
<includeTests>true</includeTests>
<skip>${pmd.skip}</skip>
<sourceEncoding>${project.sourceEncoding}</sourceEncoding>
<rulesets>
<ruleset>${pmd.ruleset.location}</ruleset>
</rulesets>
</configuration>
<executions>
<execution>
<id>cpd-report</id>
<phase>test-compile</phase>
<goals>
<goal>check</goal>
<goal>cpd-check</goal>
<goal>pmd</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!--<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</reporting>-->
Here test.jar is my jar bundled (i.e. pmd jar unbundled, added class file & ruleset and again bundled it as test.jar). Although this is not how I want to use the rule. But if there is a better way to use pmd jar as it is & add a mvn dependency for new rule that is the ideal solution I'm looking for. Thanks!
You need to add your custom rule jar to the classpath when PMD runs. You should bundle your custom PMD rule in its own Maven dependency, then you can include it in the PMD plugin classpath by adding a dependency to your plugin configuration like so:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.7</version>
<dependencies>
<dependency>
<groupId>com.foo.bar</groupId>
<artifactId>my-custom-pmd-rule</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
...
</plugin>
See this page for more information about plugin classloading. See how it says:
Please note that the plugin classloader does neither contain the dependencies of the current project nor its build output
Try changing your pom.xml file to the following. Notice I moved your test.jar dependency to the plugin dependencies so that it'll be loaded on the plugin's classpath. Note that you don't have to bundle your rules with PMD. You just need to package your rules in its own jar and include it in the plugin dependencies section.
<findbugs-maven-plugin.version>3.0.3</findbugs-maven-plugin.version>
<findbugs.include.filter.location>buildtools/findbugs/include.xml</findbugs.include.filter.location>
<findbugs.exclude.filter.location>buildtools/findbugs/exclude.xml</findbugs.exclude.filter.location>
<maven-pmd-plugin.version>3.5</maven-pmd-plugin.version>
<pmd.version>5.3.2</pmd.version>
<pmdRule.version>5.1.0</pmdRule.version>
<pmd.ruleset.location>buildtools/pmd-rules/ltyawardsservicepmd.xml</pmd.ruleset.location>
<pmd.skip>false</pmd.skip>
<pmd.typeResolution>true</pmd.typeResolution>
<!-- spring boot -->
<debug.port>5000</debug.port>
<run.jvmArguments>-Dspring.profiles.active=dev -Dapplication.home=. -Dapplication.name=${project.name}
-Dapplication.environment=dev -Dproject.name=${project.name} -Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=${debug.port}
</run.jvmArguments>
<error-inspector.version>0.1.9</error-inspector.version>
<platform-diagnostics.version>0.0.43</platform-diagnostics.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Camden.SR6</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.comp.prime.errorcatalog</groupId>
<artifactId>error-inspector</artifactId>
<version>${error-inspector.version}</version>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/error-inspect</outputDirectory>
<destFileName>inspect.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>com.comp.www.platform</groupId>
<artifactId>platform-diagnostics-main</artifactId>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/error-inspect/lib</outputDirectory>
<destFileName>platform-diagnostics-main.jar</destFileName>
</artifactItem>
</artifactItems>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<message>.*** ERROR: Detected Maven version ${maven.version}, We need Maven 3.0.3 or
higher ***.
</message>
<version>[3.0.3,)</version>
</requireMavenVersion>
<requireJavaVersion>
<message>.*** ERROR: Detected JDK version ${java.version}, We need JDK
${project.jdk.version} or higher ***.
</message>
<version>${project.jdk.version}</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
<execution>
<id>enforce-dont-exist</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireFilesDontExist>
<files>
<file>${project.basedir}/src/main/scala</file>
</files>
</requireFilesDontExist>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${project.jdk.version}</source>
<target>${project.jdk.version}</target>
<encoding>UTF-8</encoding>
</configuration>
<version>3.3</version>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin.version}</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<scalaCompatVersion>${scala.major.minor.version}</scalaCompatVersion>
<jvmArgs>
<jvmArg>-Xms512m</jvmArg>
<jvmArg>-Xmx2048m</jvmArg>
</jvmArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${maven-pmd-plugin.version}</version>
<dependencies>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
<version>${pmd.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-java</artifactId>
<version>${pmd.version}</version>
</dependency>
<dependency>
<groupId>WhileLoopsMustUseBracesRule</groupId>
<artifactId>pmd.ruleset</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>system</scope><systemPath>/Users/babu/Downloads/cache.jar</systemPath>
</dependency>
<dependency>
<groupId>com.comp.www.platform</groupId>
<artifactId>platform-build-tools</artifactId>
<version>${platform-build-tools.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>${pmdRule.version}</version>
<scope>system</scope>
<systemPath>/Users/babu/.m2/repository/net/sourceforge/pmd/pmd/5.1.0/test.jar</systemPath>
</dependency>
</dependencies>
<configuration>
<targetJdk>${project.jdk.version}</targetJdk>
<includeTests>true</includeTests>
<skip>${pmd.skip}</skip>
<sourceEncoding>${project.sourceEncoding}</sourceEncoding>
<rulesets>
<ruleset>${pmd.ruleset.location}</ruleset>
</rulesets>
</configuration>
<executions>
<execution>
<id>cpd-report</id>
<phase>test-compile</phase>
<goals>
<goal>check</goal>
<goal>cpd-check</goal>
<goal>pmd</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!--<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</reporting>-->
I am having an issue migrating from Adobe Flex 3.3.0.4852 to 4.5.1.21328
Applying the same configuration I had it set up it throws a exception executing flexmojos-maven-plugin
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>3.2.0</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>compile-swf</goal>
</goals>
</execution>
</executions>
<configuration>
<moduleFiles>
<module>APP_MIGRATED.mxml</module>
</moduleFiles>
<locales>
<param>en_US</param>
</locales>
<services>${basedir}/src/main/resources/services-config.xml</services>
<contextRoot>root</contextRoot>
<keepAllTypeSelectors>true</keepAllTypeSelectors>
<output>${basedir}/target/APP_MIGRATED.swf</output>
<targetPlayer>9.0.0</targetPlayer>
</configuration>
</plugin>
The error is triying to compile the source it trows the next error:
[ERROR]
C:\m2_repo_clean\com\adobe\flex\framework\advancedgrids\4.5.1.21328\advancedgrids-4.5.1.21328.swc$defaults.css:[13,-1]
{ expected. [ERROR]
C:\m2_repo_clean\com\adobe\flex\framework\charts\4.5.1.21328\charts-4.5.1.21328.swc$defaults.css:[13,-1]
{ expected. [ERROR]
C:\m2_repo_clean\com\adobe\flex\framework\charts\4.5.1.21328\charts-4.5.1.21328.swc$defaults.css:[14,-1]
{ expected. [ERROR]
C:\m2_repo_clean\com\adobe\flex\framework\charts\4.5.1.21328\charts-4.5.1.21328.swc$defaults.css:[108,-1]
Unexpected character: D. [ERROR]
C:\m2_repo_clean\com\adobe\flex\framework\charts\4.5.1.21328\charts-4.5.1.21328.swc$defaults.css:[112,-1]
{ expected. [ERROR]
C:\m2_repo_clean\com\adobe\flex\framework\framework\4.5.1.21328\framework-4.5.1.21328.swc$defaults.css:[15,-1]
{ expected. [ERROR]
C:\m2_repo_clean\com\adobe\flex\framework\mx\4.5.1.21328\mx-4.5.1.21328.swc$defaults.css:[15,-1]
{ expected. [ERROR]
C:\m2_repo_clean\com\adobe\flex\framework\spark\4.5.1.21328\spark-4.5.1.21328.swc$defaults.css:[15,-1]
{ expected. [WARNING]
C:\Workspaces\aa_Branches\aa_jdk8_upgrade\flex\src\main\flexapp\APP_MIGRATED.mxml:[0,-1]
CSS selector condition type is not supported: ':normalWithPrompt'
[WARNING]
C:\Workspaces\aa_Branches\aa_jdk8_upgrade\flex\src\main\flexapp\APP_MIGRATED.mxml:[0,-1]
CSS selector condition type is not supported: ':disabledWithPrompt'
This is my full pom configuration
<parent>
<artifactId>app-migrated</artifactId>
<groupId>com.appmigrated</groupId>
<version>1.7-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>flex</artifactId>
<packaging>pom</packaging>
<name>Flex</name>
<build>
<finalName>APP_MIGRATED</finalName>
<sourceDirectory>src/main/flexapp</sourceDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${basedir}/target/generated-resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>${flex-mojos.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>compile-swf</goal>
</goals>
</execution>
</executions>
<configuration>
<moduleFiles>
<module>APP_MIGRATED.mxml</module>
</moduleFiles>
<locales>
<param>en_US</param>
</locales>
<services>${basedir}/src/main/resources/services-config.xml</services>
<contextRoot>root</contextRoot>
<keepAllTypeSelectors>true</keepAllTypeSelectors>
<output>${basedir}/target/APP_MIGRATED.swf</output>
<targetPlayer>9.0.0</targetPlayer>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
<goal>wrapper</goal>
</goals>
<phase>generate-resources</phase>
</execution>
</executions>
<configuration>
<ignoreVersionIssues>true</ignoreVersionIssues>
<htmlName>APP_MIGRATED</htmlName>
<outputDirectory>${project.build.directory}/html-wrapper</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-config</id>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
<includeArtifacIds>APP_MIGRATED</includeArtifacIds>
<includeGroupIds>${project.groupId}</includeGroupIds>
<excludeTransitive>true</excludeTransitive>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make.html-bundle</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>src/main/assembly/html-bundle.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make.resources</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>src/main/assembly/resources.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<flex.sdk.version>4.5.1.21328</flex.sdk.version>
<flex-mojos.version>4.0-RC2</flex-mojos.version>
</properties>
<dependencies>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>flex-framework</artifactId>
<version>${flex.sdk.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.adobe.cairngorm</groupId>
<artifactId>cairngorm</artifactId>
<version>2.2.1</version>
<type>swc</type>
</dependency>
</dependencies>
I know maybe there is can be another errors after this one, but this is the one which concerns me more.
Greetings,
try flexmojos 7 :
<properties>
<flexmojos.version>7.0.1</flexmojos.version>
<flex.version>4.13.0.20140701</flex.version>
<flash.version>16.0</flash.version>
</properties>
plugin look like this
<plugins>
<plugin>
<groupId>net.flexmojos.oss</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>${flexmojos.version}</version>
<extensions>true</extensions>
<configuration>
<sourceFile>APP_MIGRATED.mxml</sourceFile>
<compilerWarnings>
<warn-no-constructor>false</warn-no-constructor>
</compilerWarnings>
</configuration>
<dependencies>
<!-- This handles a bug in maven which causes problems with flex resources -->
<dependency>
<groupId>net.flexmojos.oss</groupId>
<artifactId>flexmojos-threadlocaltoolkit-wrapper</artifactId>
<version>${flexmojos.version}</version>
</dependency>
<!-- Without this FM will use the compiler configured in its master
pom, which will result in version conflicts -->
<dependency>
<groupId>org.apache.flex</groupId>
<artifactId>compiler</artifactId>
<version>${flex.version}</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>
I use aspectj-maven-plugin and jetty-all in my java project.
But after run "mvn clean install" there will be a warning message.
....
[INFO] --- aspectj-maven-plugin:1.8:compile (default) # as ---
[INFO] Showing AJC message detail for messages of types: [error, warning, fail]
[WARNING] incorrect classpath: /home/xxxx/.m2/repository/org/eclipse/jetty/aggregate/jetty-all/9.3.8.v20160314/jetty-all-9.3.8.v20160314.pom
<unknown source file>:<no line information>
....
If I remove aspectj maven plugin there will be no warning.
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>xxx</groupId>
<artifactId>xxx</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>xxx</name>
<url>xxx</url>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all</artifactId>
<version>9.3.8.v20160314</version>
<type>pom</type>
</dependency>
...
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.7</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.7</version>
</dependency>
</dependencies>
<profiles>
...
</profiles>
<build>
<finalName>xxx</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>xxx.xxx.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.8</version>
<configuration>
<complianceLevel>1.8</complianceLevel>
<source>1.8</source>
<target>1.8</target>
<proc>none</proc>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>xxx.xxx.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>copy</id>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<exec dir="${basedir}" executable="svn"
failifexecutionfails="false"
output="${project.build.directory}/classes/svn.txt">
<arg line="info"/>
</exec>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3</version>
<configuration>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>
<source>1.8</source>
<target>1.8</target>
<showWarnings>true</showWarnings>
<encoding>UTF-8</encoding>
<compilerArguments>
<extdirs>src/main/webapp/WEB-INF/lib</extdirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<!-- use the following if you're not using a snapshot version. -->
<repository>
<id>releases</id>
<url>xxx</url>
</repository>
<!-- use the following if you ARE using a snapshot version. -->
<snapshotRepository>
<id>snapshots</id>
<url>xxx</url>
</snapshotRepository>
</distributionManagement>
</project>
Could anybody tell me how to fix it?
The warning that you get to see are generated by the plugin used :
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.8</version>
<configuration>
<complianceLevel>1.8</complianceLevel>
<bootclasspath><!--try including correct classpath here--></bootclasspath>
<source>1.8</source>
<target>1.8</target>
<proc>none</proc>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>