I'm trying to setup SonarQube (v.4.5.6) with maven support. I believe my configuration is correct but I can't get SonarQube analysis to run without errors.
My project's dependencies:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>${logstash-logback-encoder.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<version>${spring-security-test.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
sonar-maven-plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.7.1</version>
</plugin>
SonarQube analysis throws the following errors:
[INFO] [19:07:06.235] Source paths: pom.xml, src/main/java
[INFO] [19:07:06.235] Test paths: src/test/java
[INFO] [19:07:06.235] Binary dirs: target/classes
[INFO] [19:07:08.046] Sensor JavaSquidSensor...
[INFO] [19:07:08.154] Configured Java source version: none
[INFO] [19:07:08.157] JavaClasspath initialization...
[INFO] [19:07:08.173] JavaClasspath initialization done: 16 ms
[INFO] [19:07:08.173] JavaTestClasspath initialization...
[INFO] [19:07:08.202] JavaTestClasspath initialization done: 29 ms
[INFO] [19:07:08.412] Java Main Files AST scan...
[INFO] [19:07:08.414] 27 source files to be analyzed
[ERROR] [19:07:08.849] Class not found: org.springframework.security.openid.OpenIDAuthenticationFilter
[ERROR] [19:07:08.850] Class not found: org.springframework.security.openid.OpenIDConsumer
[ERROR] [19:07:08.850] Class not found: org.openid4java.consumer.ConsumerManager
[ERROR] [19:07:08.850] Class not found: org.springframework.security.openid.OpenIDAuthenticationToken
[ERROR] [19:07:08.851] Class not found: org.openid4java.consumer.ConsumerException
[ERROR] [19:07:08.851] Class not found: org.springframework.security.openid.AxFetchListFactory
[ERROR] [19:07:08.872] Class not found: org.springframework.jdbc.datasource.init.DatabasePopulator
[ERROR] [19:07:08.872] Class not found: org.springframework.jdbc.datasource.init.DataSourceInitializer
[ERROR] [19:07:09.798] Class not found: javax.annotation.Nullable
[INFO] [19:07:10.163] 27/27 source files have been analyzed
[INFO] [19:07:10.163] Java Main Files AST scan done: 1751 ms
[INFO] [19:07:10.165] Java bytecode scan...
[INFO] [19:07:10.238] Java bytecode scan done: 73 ms
[INFO] [19:07:10.239] Java Test Files AST scan...
[INFO] [19:07:10.239] 17 source files to be analyzed
[ERROR] [19:07:10.400] Class not found: org.springframework.security.openid.OpenIDAuthenticationFilter
[ERROR] [19:07:10.400] Class not found: org.springframework.security.openid.OpenIDConsumer
[ERROR] [19:07:10.401] Class not found: org.openid4java.consumer.ConsumerManager
[ERROR] [19:07:10.401] Class not found: org.springframework.security.openid.OpenIDAuthenticationToken
[ERROR] [19:07:10.401] Class not found: org.openid4java.consumer.ConsumerException
[ERROR] [19:07:10.401] Class not found: org.springframework.security.openid.AxFetchListFactory
[INFO] [19:07:11.114] Java Test Files AST scan done: 875 ms
[INFO] [19:07:11.114] 17/17 source files have been analyzed
All mentioned classes are not used in project, which I for me makes more confusing what could be wrong.
You can see that the analysis run until the end without saying it failed. The analysis succeed.
What this message ´Class not found:´ means ?
This is raised by sonarqube java analyzer when it analyzes the dependency of a source file. For instance, if you extends a class from spring, sonarqube java analyzer will look for the corresponding .class file.
If we have a rule that will count the number of hierarchy level, it will then look for the dependency of this .class file and so on. Meaning it will look for some classes that might not be directly in your project.
This message is harmless, it just warns you that the analyzer was not able to find some .class files so you might end up with less accurate results and/or you might want to fix the classpath provided to the analysis.
Related
I have a java jersey spring based maven application. I imported into my Eclipse, and when Maven starts downloading all dependencies (jars), they are all corrupted with very low sized files(<10kb). I deleted the .m2 repo and ran the mvn clean install command multiple times, but I still get the same corrupted files.
Is there something wrong with pom.xml? Below is my pom.xml:
<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>com.kreator.rest</groupId>
<artifactId>kreatorRestServices</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>kreatorRestServices Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>codelds</id>
<url>https://code.lds.org/nexus/content/groups/main-repo</url>
</repository>
<repository>
<id>maven2-repository.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
<repository>
<id>maven2-repository.java.nettt</id>
<url>https://mvnrepository.com/artifact/org.glassfish.jersey.ext/jersey-spring3</url>
</repository>
</repositories>
<!-- Specifying the Versions of Spring, Hiberante, MySQL etc -->
<properties>
<hibernate.version>4.3.8.Final</hibernate.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.velocity/velocity -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.1</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.11</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>2.11</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.22.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.2.RELEASE</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.11</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.6.11</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc5</artifactId>
<version>11.2.0.2.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>kreatorRestServices</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>2.0.3</version>
<configuration>
<appName>kreatorbackendservices</appName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals><goal>copy</goal></goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.github.jsimone</groupId>
<artifactId>webapp-runner</artifactId>
<version>9.0.30.0</version>
<destFileName>webapp-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
And the error I see (when i run the build):
[WARNING] The POM for commons-lang:commons-lang:jar:2.6 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.velocity:velocity:jar:1.7 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.postgresql:postgresql:jar:42.2.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for commons-logging:commons-logging:jar:1.2 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.springframework:spring-orm:jar:4.3.2.RELEASE is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for javax.persistence:javax.persistence-api:jar:2.2 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.fasterxml.jackson.core:jackson-core:jar:2.5.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
.
.
.
.
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 38 source files to C:\Users\charrj\Documents\kreatorjavatoolservices\target\classes
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] /C:/Users/charrj/Documents/kreatorjavatoolservices/src/main/java/com/pojo/Screen.java: Some input files use unchecked or unsafe operations.
[WARNING] /C:/Users/charrj/Documents/kreatorjavatoolservices/src/main/java/com/pojo/Screen.java: Recompile with -Xlint:unchecked for details.
[INFO] 2 warnings
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] error reading C:\Users\charrj\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\apache\velocity\velocity\1.7\velocity-1.7.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\postgresql\postgresql\42.2.1\postgresql-42.2.1.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-orm\4.3.2.RELEASE\spring-orm-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\javax\persistence\javax.persistence-api\2.2\javax.persistence-api-2.2.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.5.0\jackson-core-2.5.0.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.5.0\jackson-databind-2.5.0.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.5.0\jackson-annotations-2.5.0.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\glassfish\jersey\core\jersey-server\2.11\jersey-server-2.11.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\glassfish\jersey\ext\jersey-spring3\2.11\jersey-spring3-2.11.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\glassfish\jersey\media\jersey-media-json-jackson\2.22.2\jersey-media-json-jackson-2.22.2.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-core\4.3.2.RELEASE\spring-core-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-beans\4.3.2.RELEASE\spring-beans-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-context\4.3.2.RELEASE\spring-context-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-web\4.3.2.RELEASE\spring-web-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-context-support\4.3.2.RELEASE\spring-context-support-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-aop\4.3.2.RELEASE\spring-aop-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\aspectj\aspectjrt\1.6.11\aspectjrt-1.6.11.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\aspectj\aspectjweaver\1.6.11\aspectjweaver-1.6.11.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-jdbc\4.3.2.RELEASE\spring-jdbc-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\com\oracle\ojdbc5\11.2.0.2.0\ojdbc5-11.2.0.2.0.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\hibernate\hibernate-core\4.3.8.Final\hibernate-core-4.3.8.Final.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\hibernate\hibernate-c3p0\4.3.8.Final\hibernate-c3p0-4.3.8.Final.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\apache\velocity\velocity\1.7\velocity-1.7.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\postgresql\postgresql\42.2.1\postgresql-42.2.1.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-orm\4.3.2.RELEASE\spring-orm-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\javax\persistence\javax.persistence-api\2.2\javax.persistence-api-2.2.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.5.0\jackson-core-2.5.0.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.5.0\jackson-databind-2.5.0.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.5.0\jackson-annotations-2.5.0.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\glassfish\jersey\core\jersey-server\2.11\jersey-server-2.11.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\glassfish\jersey\ext\jersey-spring3\2.11\jersey-spring3-2.11.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\glassfish\jersey\media\jersey-media-json-jackson\2.22.2\jersey-media-json-jackson-2.22.2.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-core\4.3.2.RELEASE\spring-core-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-beans\4.3.2.RELEASE\spring-beans-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-context\4.3.2.RELEASE\spring-context-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-web\4.3.2.RELEASE\spring-web-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-context-support\4.3.2.RELEASE\spring-context-support-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-aop\4.3.2.RELEASE\spring-aop-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\aspectj\aspectjrt\1.6.11\aspectjrt-1.6.11.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\aspectj\aspectjweaver\1.6.11\aspectjweaver-1.6.11.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\springframework\spring-jdbc\4.3.2.RELEASE\spring-jdbc-4.3.2.RELEASE.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\com\oracle\ojdbc5\11.2.0.2.0\ojdbc5-11.2.0.2.0.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\hibernate\hibernate-core\4.3.8.Final\hibernate-core-4.3.8.Final.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\org\hibernate\hibernate-c3p0\4.3.8.Final\hibernate-c3p0-4.3.8.Final.jar; error in opening zip file
[ERROR] error reading C:\Users\charrj\.m2\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar; error in opening zip file
Any help will be much appreciated. I can't go and download jars manually, because I'm trying to deploy the app on Heroku as well, so that anyway will try to download the files again. So it is not just my local .m2 repo alone that's affected because of this.
I was trying to build an application using maven build.It was returning this build failure even though I have placed my pom.xml file is in-place.
I have configure my pom with out any issue.But I can see that there is some error returning related to schema.But don't have much information on that
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.amazon:amazon:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework.boot:spring-boot-starter-test:jar -> duplicate declaration of version (?) # line 65, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyApplication 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) # amazon ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) # amazon ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to /Users/Arun/Documents/SpringBoot/MyApplication/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.051 s
[INFO] Finished at: 2018-06-09T08:00:55-07:00
[INFO] Final Memory: 25M/220M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project amazon: Fatal error compiling: invalid target release: 1.8.0_73 -> [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/MojoExecutionException
Below is the pom.xml which I am using as of now.
<?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>com.amazon</groupId>
<artifactId>amazon</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MyApplication</name>
<description>Demo project</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8.0_73</java.version>
<start-class>com.amazon.service.MyApplication</start-class>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-jasper -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
According to your logs:
Fatal error compiling: invalid target release: 1.8.0_73
You might be using an inferior JDK version (1.7 for example) to compile your project to a higher target version (1.8.0_73 in your case).
Try installing JDK 1.8 and make your JAVA_HOME environment variable point to it.
Generally you should make sure the source JDK and target JDK are matching between your pom.xml file and your JAVA_HOME environment variable.
You can try maven compiler plugin
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
Remove the duplicate dependency added
<artifactId>spring-boot-starter-test</artifactId>
And
Try pointing to JDK 1.8 in project build path and make your JAVA_HOME environment to this
In general the minor release number (for java) is not configured in pom.xml. Only major release number will be require.
Try to change 1.8.0_73 to 1.8.
To understand the java version system please visit this link.
Looking in your maven output, it is clear that you have a duplicate dependency declaration. Moreover, it is clear that the duplicate dependency is the org.springframework.boot:spring-boot-starter-test.
What is the process of solving the issue and removing this WARNING:
Look VERY carefully your pom.xml. You probably have declared the dependency twice.
An other cause of this warning might be that a dependency is declared twice, but with different versions. The solution, again, is to delete the dependency for one of them.
Command mvn dependency:tree -Dverbose might be useful.
Finally, after writing the above process, I looked in the pom.xml file you posted in your question and found that you have declared the following dependency twice (line:54 and line:65).
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
As far as I am concerned, this library is used for testing purposes only. If this is true, depending on your requirements, you should keep only the dependency in line 54 and the warning will be removed.
I have converted my existing project from vaadin 7 to vaadin 8 successfully. There is no error in the project, but when I use mvn install to build the project. I am getting this error:- GWT Module com.vaadin.v7.Vaadin7WidgetSet not found in project sources or resources.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:51 min
[INFO] Finished at: 2017-12-19T12:31:15+05:30
[INFO] Final Memory: 94M/1007M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:8.0.6:compile (default) on project XXX: GWT Module com.vaadin.v7.Vaadin7WidgetSet not found in project sources or resources. -> [Help 1]
From here:
Check the following:
You have to replace the vaadin-server dependency with vaadin-compatibility-server.
If you are using the default widgetset (you are not compiling it by yourself):
Replace the vaadin-client-compiled dependency with vaadin-compatibility-client-compiled.
Add #Widgetset("com.vaadin.v7.Vaadin7WidgetSet") to your UI implementations.
If you are using a custom widgetset:
Replace the vaadin-client dependency with vaadin-compatibility-client.
Recompile it.
In your POM I see these lines:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>7.5.10</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>7.5.10</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<version>7.5.10</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<version>7.5.10</version>
<exclusions>
<exclusion>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
This won't work, you can't include any version 7 components, servers, clients.
The only valid thing, is to use the v8-compatibility things.
I have been trying to build a code using maven. But I am stuck with an error.
My system configurations as shown by maven is followning:
Apache Maven 3.0.2 (r1056850; 2011-01-09 07:58:10+0700)
Java version: 1.7.0_05, vendor: Oracle Corporation
Java home: /home/bhphuc/soft/jdk1.7.0_05/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.11.0-15-generic", arch: "amd64", family: "unix"
Following is the Maven trace for the error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project SpringExample: Compilation failure: Compilation failure:
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[3,24] error: package javax.persistence does not exist
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[4,24] error: package javax.persistence does not exist
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[5,24] error: package javax.persistence does not exist
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[6,31] error: package javax.persistence does not exist
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[6,0] error: static import only from classes and interfaces
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[7,24] error: package javax.persistence does not exist
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[8,24] error: package javax.persistence does not exist
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[9,24] error: package javax.persistence does not exist
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[11,1] error: cannot find symbol
[ERROR] class Entity
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[12,1] error: cannot find symbol
[ERROR] class Table
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[29,2] error: cannot find symbol
[ERROR] class Stock
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[30,2] error: cannot find symbol
[ERROR] class Stock
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[31,2] error: cannot find symbol
[ERROR] class Stock
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[40,2] error: cannot find symbol
[ERROR] class Stock
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[49,2] error: cannot find symbol
[ERROR] -> [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/MojoFailureException
the pom.xml file.
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mkyong.common</groupId>
<artifactId>SpringExample</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>SpringExample</name>
<url>http://maven.apache.org</url>
<properties>
<spring.version>3.0.5.RELEASE</spring.version>
</properties>
<dependencies>
<!-- JUnit testing framework -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- Spring framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Spring AOP dependency -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2</version>
</dependency>
<!-- MySQL database driver -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
<!-- Hibernate framework -->
<dependency>
<groupId>hibernate</groupId>
<artifactId>hibernate3</artifactId>
<version>3.2.3.GA</version>
</dependency>
<!-- Hibernate annotation -->
<dependency>
<groupId>hibernate-annotations</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.3.0.GA</version>
</dependency>
<dependency>
<groupId>hibernate-commons-annotations</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>3.0.0.GA</version>
</dependency>
<!-- Hibernate library dependecy start -->
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>2.7.7</version>
</dependency>
<!-- Hibernate library dependecy end -->
</dependencies>
</project>
the pom.xml fail ???
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
</dependency>
try to add this dependency in your pom file. Also had you noticed the error
[ERROR] /home/bhphuc/Axs/SpringHibernateAnnotationExample/src/main/java/com/mkyong/stock/model/Stock.java:[6,0] error: static import only from classes and interface
Did you used any static imports there (in Stock class) ?? Also please check your JDK version.
The pom.xml 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.codehaus.sonar-plugins.java</groupId>
<artifactId>java</artifactId>
<version>2.3-SNAPSHOT</version>
</parent>
<artifactId>java-checks</artifactId>
<name>SonarQube Java :: Checks</name>
<dependencies>
<dependency>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-deprecated</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>java-squid</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.sonar.sslr</groupId>
<artifactId>sslr-testing-harness</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
I've been trying to run this pom.xml on eclipse, and i kept having this error of:
[INFO]
------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO]
------------------------------------------------------------------------ [INFO] Total time: 2:22.878s [INFO] Finished at: Wed May 21 10:53:12
CST 2014 [INFO] Final Memory: 10M/61M [INFO]
------------------------------------------------------------------------ [ERROR] Failed to execute goal on project java-checks: Could not
resolve dependencies for project
org.codehaus.sonar-plugins.java:java-checks:jar:2.3-SNAPSHOT: The
following artifacts could not be resolved:
org.codehaus.sonar:sonar-deprecated:jar:4.2-RC1,
org.codehaus.sonar:sonar-plugin-api:jar:4.2-RC1,
org.codehaus.sonar:sonar-check-api:jar:4.2-RC1,
org.codehaus.sonar:sonar-colorizer:jar:4.2-RC1,
org.codehaus.sonar:sonar-graph:jar:4.2-RC1,
org.codehaus.sonar:sonar-squid:jar:4.2-RC1,
org.codehaus.sonar-plugins.java:java-squid:jar:2.3-SNAPSHOT: Could not
transfer artifact org.codehaus.sonar:sonar-deprecated:jar:4.2-RC1
from/to central (http://repo.maven.apache.org/maven2): No response
received after 60000 -> [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/DependencyResolutionException
Is there anything i need to add to pom.xml?
It's all in the log:
No response received after 60000
Maven is trying to download dependencies for the plugins that you are using, and it's failing because of a timeout. Check your network connection and ensure you can access the Maven central repository (http://repo.maven.apache.org/maven2).