Error while building spring boot project [duplicate] - java

This question already has answers here:
How to add a dependency to a Spring Boot Jar in another project?
(12 answers)
Closed 5 years ago.
i am unable to build my springboot project,
I am using classes from another springboot jar, which i placed on the build path, its running in local via eclipse, but is not building, here's the error
"[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ContentManagementService 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # contentmanagementapi ---
[INFO] Deleting /home/bhargavgundu/git/contentmanagementservice/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # contentmanagementapi ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # contentmanagementapi ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 42 source files to /home/bhargavgundu/git/contentmanagementservice/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/bhargavgundu/git/contentmanagementservice/src/main/java/com/conduiraonline/controller/ContentManagementControllerV1.java:[32,31] package com.conduiraonline.apis does not exist
[ERROR] /home/bhargavgundu/git/contentmanagementservice/src/main/java/com/conduiraonline/controller/ContentManagementControllerV1.java:[42,31] package com.conduiraonline.daos does not exist
[ERROR] /home/bhargavgundu/git/contentmanagementservice/src/main/java/com/conduiraonline/controller/ContentManagementControllerV1.java:[52,35] cannot find symbol
symbol: class SlackService
location: package com.conduiraonline.services
[ERROR] /home/bhargavgundu/git/contentmanagementservice/src/main/java/com/conduiraonline/controller/ContentManagementControllerV1.java:[85,17] cannot find symbol
symbol: class UserDAO
location: class com.conduiraonline.controller.ContentManagementControllerV1
[ERROR] /home/bhargavgundu/git/contentmanagementservice/src/main/java/com/conduiraonline/controller/ContentManagementControllerV1.java:[87,17] cannot find symbol
symbol: class SlackService
location: class com.conduiraonline.controller.ContentManagementControllerV1
[ERROR] /home/bhargavgundu/git/contentmanagementservice/src/main/java/com/conduiraonline/controller/ContentManagementControllerV1.java:[95,17] cannot find symbol
symbol: class LicenseV5
location: class com.conduiraonline.controller.ContentManagementControllerV1
[INFO] 6 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.917s
[INFO] Finished at: Tue Sep 12 17:16:44 IST 2017
[INFO] Final Memory: 24M/396M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project contentmanagementapi: Compilation failure: Compilation failure:
[ERROR] /home/bhargavgundu/git/contentmanagementservice/src/main/java/com/conduiraonline/controller/ContentManagementControllerV1.java:[32,31] package com.conduiraonline.apis does not exist
[ERROR] /home/bhargavgundu/git/contentmanagementservice/src/main/java/com/conduiraonline/controller/ContentManagementControllerV1.java:[42,31] package com.conduiraonline.daos does not exist
[ERROR] /home/bhargavgundu/git/contentmanagementservice/src/main/java/com/conduiraonline/controller/ContentManagementControllerV1.java:[52,35] cannot find symbol
[ERROR] symbol: class SlackService
[ERROR] location: package com.conduiraonline.services
[ERROR] /home/bhargavgundu/git/contentmanagementservice/src/main/java/com/conduiraonline/controller/ContentManagementControllerV1.java:[85,17] cannot find symbol
[ERROR] symbol: class UserDAO
[ERROR] location: class com.conduiraonline.controller.ContentManagementControllerV1
[ERROR] /home/bhargavgundu/git/contentmanagementservice/src/main/java/com/conduiraonline/controller/ContentManagementControllerV1.java:[87,17] cannot find symbol
[ERROR] symbol: class SlackService
[ERROR] location: class com.conduiraonline.controller.ContentManagementControllerV1
[ERROR] /home/bhargavgundu/git/contentmanagementservice/src/main/java/com/conduiraonline/controller/ContentManagementControllerV1.java:[95,17] cannot find symbol
[ERROR] symbol: class LicenseV5
[ERROR] location: class com.conduiraonline.controller.ContentManagementControllerV1
[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
"
It is showing errors wherever i am using classes/functions from the external jar, can someone help?
MY POM-
here is my POM
<?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.conduiraonline</groupId>
<artifactId>contentmanagementapi</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>ContentManagementService</name>
<description>ContentManagementService</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.mail/mail -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.conduiraonline</groupId>
<artifactId>licenseapi</artifactId>
<version>0.0.1</version>
<classifier>exec</classifier>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>21.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
</plugins>
</build>
</project>

TL;DR
Remove <classifier>exec</classifier> from the dependency on com.conduiraonline:licenseapi
More Details ...
You are correct in using <dependency> to express the relationship between com.conduiraonline:contentmanagementapi and com.conduiraonline:licenseapi. Or to put it another way; this is the right way to tell Maven that the module com.conduiraonline:contentmanagementapi depends on the module com.conduiraonline:licenseapi.
However, you have defined the dependency on com.conduiraonline:licenseapi as:
<dependency>
<groupId>com.conduiraonline</groupId>
<artifactId>licenseapi</artifactId>
<version>0.0.1</version>
<classifier>exec</classifier>
</dependency>
The classifier tells Maven to look for an file named licenseapi.exec in the folder com/conduiraonline in your local Maven repo (and failing that, try to resolve that dependency from whatever remote repositories you have configured in your Maven settings.xml or in this pom.xml).
I presume there is no file named licenseapi.exec in the folder com/conduiraonline in your local Maven repo because exec is a very unusual classifier for a Maven artifact.
As long as a JAR for com.conduiraonline:licenseapi with version 0.0.1 has been installed in your local Maven repo this dependency will work:
<dependency>
<groupId>com.conduiraonline</groupId>
<artifactId>licenseapi</artifactId>
<version>0.0.1</version>
</dependency>
You install a JAR for com.conduiraonline:licenseapi with version 0.0.1 in your local Maven repo by running mvn clean install for the licenseapi module (assuming that the pom.xml for the licenseapi modules has <version>0.0.1</version>).

You must add the path of your jars / folder containing jars in your gradle or maven build file.
For example in gradle add
compile fileTree(dir: 'path_to_ext_libs', include: '*.jar')
to your dependencies in the build.gradle then all the jars in the libs folder will be then included.
or in maven
<repositories>
<repository>
<id>local-files</id>
<name>local-files</name>
<url>file://c:\test\filerepo</url>
</repository>

Related

Maven Configuration Problem with Version 2.1.7 - Spring Boot

when i am trying to create Spring Boot Project using New Version which is "v 2.1.7"
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
this time its through Following error:
Description Resource Path Location
Type
Unknown pom.xml /demo-1 line 1 Maven Configuration Problem
If i am going to replace This new Version to my previous old version in porm.xml file with name space its Working good without any error,
and if i deleted .m2 folder and reinstall eclipse then its support to new version but i want to use existing eclipse with New version of Spring Boot, what can i do for it.
it is possible to update existing .m2 folder ?
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo-1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo-1</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
when i am trying to install maven this time following error show
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< com.example:demo-1 >-------------------------
[INFO] Building demo-1 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # demo-1 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # demo-1 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\Enternship\SPRING BOOT\demo-1\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.933 s
[INFO] Finished at: 2019-09-02T18:45:56+05:30
[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.8.1:compile (default-compile) on project demo-1: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[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
just configure the JDK path the steps are
right-click on the project
click on properties
type java build path and go to java build path
click on libraries
click on JRE system libraries
edit that
click on alternate JRE
click on Installed JREs
click on Add
select standard VM
click Next
place your JDK path and select that
By this, you will not see the error
=>No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

Could not resolve dependencies for project in heroku

I am trying to deploy maven web app in the Heroku which have a dependency on some other application. When I am trying to deploy the app and getting this error. I have no clue what is going wrong in passing the dependency.
This is my pom.xml file
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.1.3.RELEASE
com.merizameen
merizameen
0.0.1-SNAPSHOT
merizameen
Frontend project for Merizameen
<properties>
<start-class>com.merizameen.MerizameenApplication</start-class>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- MY PROJECT -->
<dependency>
<groupId>com.merizameen</groupId>
<artifactId>merizameenbackend</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Error Logs---------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.953 s
[INFO] Finished at: 2019-04-16T18:29:11+00:00
[INFO] Final Memory: 20M/162M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project merizameen: Could not resolve dependencies for project com.merizameen:merizameen:jar:0.0.1-SNAPSHOT: Could not find artifact com.merizameen:merizameenbackend:jar:0.0.1-SNAPSHOT -> [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
! ERROR: Failed to build app with Maven
We're sorry this build is failing! If you can't find the issue in application code,
please submit a ticket so we can help: https://help.heroku.com/
! Push rejected, failed to compile Java app.
! Push failed
You'll need to add com.merizameen:merizameenbackend as an un-managed dependency with a command like:
$ mvn deploy:deploy-file -Durl=file:///path/to/yourproject/repo/ -Dfile=merizameenbackend.jar -DgroupId=com.merizameen -DartifactId=merizameenbackend -Dpackaging=jar -Dversion=1.0
See this guide: https://devcenter.heroku.com/articles/local-maven-dependencies

Running scala under maven project

i am running scala project .I woudld like to use maven project but , it seems doesn't recognize scala .Because before i used add scala nature now i would ike to add scala through maven , but i can't get it doesnt .i used scala 2.11.8
here is the 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>SynchData</groupId>
<artifactId>SynchData</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-catalyst_2.11</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.1.3</version>
</dependency>
<!-- <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId>
<version>9.2-1002-jdbc4</version> </dependency> -->
<!-- https://mvnrepository.com/artifact/oracle/ojdbc6 -->
<dependency>
<groupId>oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Once i make maven clean install i got this
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for SynchData:SynchData:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.apache.spark:spark-sql_2.11:jar -> duplicate declaration of version 2.2.0 # line 31, 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 SynchData 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # SynchData ---
[INFO] Deleting C:\Users\MHT\eclipse-workspace\test.iptech\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # SynchData ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) # SynchData ---
[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 1 source file to C:\Users\MHT\eclipse-workspace\test.iptech\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/MHT/eclipse-workspace/test.iptech/src/main/java/LauncherPack/SynchronizeData.java:[2,1] package SynchronizePackage does not exist
[ERROR] /C:/Users/MHT/eclipse-workspace/test.iptech/src/main/java/LauncherPack/SynchronizeData.java:[10,17] cannot find symbol
symbol: variable MainFunction
location: class LauncherPack.SynchronizeData
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.277 s
[INFO] Finished at: 2017-09-26T14:29:59+01:00
[INFO] Final Memory: 36M/281M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project SynchData: Compilation failure: Compilation failure:
[ERROR] /C:/Users/MHT/eclipse-workspace/test.iptech/src/main/java/LauncherPack/SynchronizeData.java:[2,1] package SynchronizePackage does not exist
[ERROR] /C:/Users/MHT/eclipse-workspace/test.iptech/src/main/java/LauncherPack/SynchronizeData.java:[10,17] cannot find symbol
[ERROR] symbol: variable MainFunction
[ERROR] location: class LauncherPack.SynchronizeData
[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
Please any help to get it work without using add scala nature through eclipse .
Thanks a lot

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project acme-module: Compilation failure:

I did everything according to this guide: https://documentation.magnolia-cms.com/display/DOCS/Getting+started+with+Blossom
I get these errors when I'm trying follow last step, mvn install (mvn clean works fine). Here is output after mvn clean install
tests-imac:acme test$ mvn clean install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.acme:acme-webapp:war:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-war-plugin is missing. # com.acme:acme-webapp:[unknown-version], /Users/staz/blossomproj/acme/acme-webapp/pom.xml, line 35, column 15
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.acme:acme-module:jar:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: javax.servlet:servlet-api:jar -> version 2.4 vs 2.5 # line 77, column 17
[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] Reactor Build Order:
[INFO]
[INFO] acme (parent pom)
[INFO] acmeModule Magnolia Module
[INFO] acme: webapp
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building acme (parent pom) 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # acme ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # acme ---
[INFO] Installing /Users/staz/blossomproj/acme/pom.xml to /Users/test/.m2/repository/com/acme/acme/1.0-SNAPSHOT/acme-1.0-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building acmeModule Magnolia Module 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # acme-module ---
[INFO] Deleting /Users/staz/blossomproj/acme/acme-module/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # acme-module ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # acme-module ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 4 source files to /Users/staz/blossomproj/acme/acme-module/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/staz/blossomproj/acme/acme-module/src/main/java/com/acme/AcmeModule.java:[17,17] error: no suitable method found for initRootWebApplicationContext(Class<AcmeModuleConfiguration>)
[ERROR] method BlossomModuleSupport.initRootWebApplicationContext(ContextLoader) is not applicable
(actual argument Class<AcmeModuleConfiguration> cannot be converted to ContextLoader by method invocation conversion)
method BlossomModuleSupport.initRootWebApplicationContext(String) is not applicable
(actual argument Class<AcmeModuleConfiguration> cannot be converted to String by method invocation conversion)
/Users/staz/blossomproj/acme/acme-module/src/main/java/com/acme/AcmeModule.java:[18,17] error: method initBlossomDispatcherServlet in class BlossomModuleSupport cannot be applied to given types;
[ERROR] actual argument Class<BlossomServletConfiguration> cannot be converted to String by method invocation conversion
/Users/staz/blossomproj/acme/acme-module/src/main/java/com/acme/BlossomServletConfiguration.java:[88,22] error: cannot find symbol
[ERROR] variable handlerMapping of type BlossomHandlerMapping
/Users/staz/blossomproj/acme/acme-module/src/main/java/com/acme/BlossomServletConfiguration.java:[140,20] error: method addContextAttribute in class AbstractRenderer cannot be applied to given types;
[ERROR] actual argument Class<Directives> cannot be converted to ContextAttributeConfiguration by method invocation conversion
/Users/staz/blossomproj/acme/acme-module/src/main/java/com/acme/BlossomServletConfiguration.java:[141,20] error: method addContextAttribute in class AbstractRenderer cannot be applied to given types;
[INFO] 5 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] acme (parent pom) .................................. SUCCESS [ 0.869 s]
[INFO] acmeModule Magnolia Module ......................... FAILURE [ 5.262 s]
[INFO] acme: webapp ....................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.003 s
[INFO] Finished at: 2015-03-06T12:01:46+01:00
[INFO] Final Memory: 23M/183M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project acme-module: Compilation failure: Compilation failure:
[ERROR] /Users/staz/blossomproj/acme/acme-module/src/main/java/com/acme/AcmeModule.java:[17,17] error: no suitable method found for initRootWebApplicationContext(Class<AcmeModuleConfiguration>)
[ERROR] method BlossomModuleSupport.initRootWebApplicationContext(ContextLoader) is not applicable
[ERROR] (actual argument Class<AcmeModuleConfiguration> cannot be converted to ContextLoader by method invocation conversion)
[ERROR] method BlossomModuleSupport.initRootWebApplicationContext(String) is not applicable
[ERROR] (actual argument Class<AcmeModuleConfiguration> cannot be converted to String by method invocation conversion)
[ERROR] /Users/staz/blossomproj/acme/acme-module/src/main/java/com/acme/AcmeModule.java:[18,17] error: method initBlossomDispatcherServlet in class BlossomModuleSupport cannot be applied to given types;
[ERROR] actual argument Class<BlossomServletConfiguration> cannot be converted to String by method invocation conversion
[ERROR] /Users/staz/blossomproj/acme/acme-module/src/main/java/com/acme/BlossomServletConfiguration.java:[88,22] error: cannot find symbol
[ERROR] variable handlerMapping of type BlossomHandlerMapping
[ERROR] /Users/staz/blossomproj/acme/acme-module/src/main/java/com/acme/BlossomServletConfiguration.java:[140,20] error: method addContextAttribute in class AbstractRenderer cannot be applied to given types;
[ERROR] actual argument Class<Directives> cannot be converted to ContextAttributeConfiguration by method invocation conversion
[ERROR] /Users/staz/blossomproj/acme/acme-module/src/main/java/com/acme/BlossomServletConfiguration.java:[141,20] error: method addContextAttribute in class AbstractRenderer cannot be applied to given types;
[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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :acme-module
Magnolia version - 5.3.7 EE
Blossom module version - 3.0.5
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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>acme</artifactId>
<groupId>com.acme</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.acme</groupId>
<artifactId>acme-module</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>acmeModule Magnolia Module</name>
<!--
<description>Please uncomment and fill in ...</description>
-->
<properties>
<magnoliaVersion>5.3.7</magnoliaVersion>
<javaVersion>1.6</javaVersion>
<blossomVersion>3.0.5</blossomVersion>
<springVersion>4.1.4.RELEASE</springVersion>
</properties>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-core</artifactId>
<version>${magnoliaVersion}</version>
</dependency>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-rendering</artifactId>
<version>${magnoliaVersion}</version>
</dependency>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-templating</artifactId>
<version>${magnoliaVersion}</version>
</dependency>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-templating-jsp</artifactId>
<version>${magnoliaVersion}</version>
</dependency>
<dependency>
<groupId>info.magnolia.blossom</groupId>
<artifactId>magnolia-module-blossom</artifactId>
<version>${blossomVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springVersion}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${springVersion}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!-- For #Valid - JSR-303 Bean Validation API -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.1.Final</version>
</dependency>
<!-- TEST -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${javaVersion}</source>
<target>${javaVersion}</target>
</configuration>
</plugin>
</plugins>
<!-- default resources configuration which will filter the module descriptor -->
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<includes>
<include>META-INF/magnolia/*</include>
</includes>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>magnolia.public</id>
<url>https://nexus.magnolia-cms.com/content/groups/public</url>
<snapshots>
</snapshots>
</repository>
<repository>
<id>magnolia.enterprise.releases</id>
<url>https://nexus.magnolia-cms.com/content/repositories/magnolia.enterprise.releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>vaadin-addons</id>
<url>https://maven.vaadin.com/vaadin-addons</url>
</repository>
</repositories>
</project>
regarding the warning
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: javax.servlet:servlet-api:jar -> version 2.4 vs 2.5 # line 77, column 17
You probably have a transient dependency that requires javax.servlet:servlet-api:2.5, but you have defined javax.servlet:servlet-api:2.4
You can either switch from javax.servlet:servlet-api:2.4 to javax.servlet:servlet-api:2.5 or add another exclusion for the javax.servlet:servlet-api:2.5 dependency. Use mvn dependency:list to find out which dependency provides the transient dependency.
Then there's another warning
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-war-plugin is missing. # com.acme:acme-webapp:[unknown-version], /Users/staz/blossomproj/acme/acme-webapp/pom.xml, line 35, column 15
add
[...]
...
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
</pluginManagement>
</build>
...
to you pom.xml
Blossom 3.0.6 was released yesterday to make it easier to use Spring java config. With that BlossomModuleSupport got new methods to initialize the application context and servlets using configuration classes. These are the methods that can't be found which breaks compilation.
With that the archetype snapshot version you're using was updated to generate a project that uses Spring java config, and hence these new methods.
So, you need to use 3.0.6 with the archetype and all should be fine.

Maven: Error when trying to maven test the codes

I have been trying to maven test my codes, but i keep having this in my console:
[INFO] Scanning for projects... [INFO]
[INFO]
------------------------------------------------------------------------ [INFO] Building SonarQube Java :: Checks 2.3-SNAPSHOT [INFO]
------------------------------------------------------------------------ [WARNING] The POM for
org.codehaus.sonar-plugins.java:java-squid:jar:2.3-SNAPSHOT is
missing, no dependency information available [INFO]
------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO]
------------------------------------------------------------------------ [INFO] Total time: 2.791s [INFO] Finished at: Wed May 21 16:18:34 CST
2014 [INFO] Final Memory: 9M/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: Could
not find artifact
org.codehaus.sonar-plugins.java:java-squid:jar:2.3-SNAPSHOT -> [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
My pom.xml are:
<?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>
Is there anyway to resolve such error?
Try to add this as a repository in your pom.xml. In the XML element repositories, add this:
<repository>
<id>sonarplugins</id>
<url>http://repository-sonarplugins.forge.cloudbees.com/snapshot/</url>
</repository>
Maven try to get java-squid.jar in 2.3-SNAPSHOT version but it does not find it in your local repository, in the central Maven repository and in the repositories you indicate in your POM. The URL I give you is an URL for a public repo which contains the artifact you need. It should work, unless if there is other missing dependencies.
A few more thing: why do you use a SNAPSHOT lib? Are you really sure you want to do that?

Categories