I'm upgrading my microservice from version 1.5.4 to 2.5.2.
I am having the current issue when building the project. From what I understood, this can happen becouse there is something wrong with the dependencies or sources of a project.
This release spring boot upgrades to Hazelcast 4 whilst keeping compatibility with Hazelcast 3.2.x. If you’re not ready to switch to Hazelcast 4, you can downgrade using the hazelcast.version property in your build. Having our application in version 3.10.2, this library will not be upgraded within the context of this user story.
However, I'm having the following issue:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Repo/microservices/eco-microservices/functional/translator-service/src/main/java/com/economical/microservices/translator/config/HazelcastConfiguration.java:[10,28] cannot find symbol
symbol: class MaxSizeConfig
location: package com.hazelcast.config
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.408 s
[INFO] Finished at: 2021-08-06T21:46:04+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project translator-service: Compilation failure
[ERROR] /C:/Repo/microservices/eco-microservices/functional/translator-service/src/main/java/com/economical/microservices/translator/config/HazelcastConfiguration.java:[10,28] cannot find symbol
[ERROR] symbol: class MaxSizeConfig
[ERROR] location: package com.hazelcast.config
[ERROR]
[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
Follows a pom file snippet:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<!-- Spring Framework Caching Support -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-spring</artifactId>
</dependency>
<!-- JSON Libraries -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>
<!-- Spring Data JPA -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
Can you please help me understand what the issue is?
You are not defining what version of the dependencies you are using. In the latest version of Hazelcast there seems not to be any MaxSizeConfig class any longer.
Related
I had a working project, when i uploaded into Github, but now when I import that into another system, it shows build failure.
The project was uploaded from Win10 and now I am importing it to Mac. It is a very basic project for Maven, and I know there is some very basic mistake that I am missing to figure.
Please find the dependencies here
<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>UI</groupId>
<artifactId>Automation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Automation</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>6.9.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>6.9.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
<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>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
After the import it is not recognizing the Hooks class that I am trying to extend to other classes too. And i get Cannot Find Symbol: Class error in the build.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/nehasingh/.p2/pool/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/Users/nehasingh/eclipse/java-2021-032/Eclipse.app/Contents/Eclipse/configuration/org.eclipse.osgi/5/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/nehasingh/.p2/pool/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/Users/nehasingh/eclipse/java-2021-032/Eclipse.app/Contents/Eclipse/configuration/org.eclipse.osgi/5/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------------< UI:Automation >----------------------------
[INFO] Building Automation 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Automation ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/nehasingh/Downloads/AutomationUI-main/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) # Automation ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /Users/nehasingh/Downloads/AutomationUI-main/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/nehasingh/Downloads/AutomationUI-main/src/main/java/UI/Automation/pageobjects/HomePage.java:[10,29] package UI.Automation.stepdfn does not exist
[ERROR] /Users/nehasingh/Downloads/AutomationUI-main/src/main/java/UI/Automation/pageobjects/HomePage.java:[14,31] cannot find symbol
symbol: class Hooks
[ERROR] /Users/nehasingh/Downloads/AutomationUI-main/src/main/java/UI/Automation/pageobjects/loginPage.java:[3,29] package UI.Automation.stepdfn does not exist
[ERROR] /Users/nehasingh/Downloads/AutomationUI-main/src/main/java/UI/Automation/pageobjects/loginPage.java:[5,32] cannot find symbol
symbol: class Hooks
[ERROR] /Users/nehasingh/Downloads/AutomationUI-main/src/main/java/UI/Automation/pageobjects/HomePage.java:[19,49] cannot find symbol
symbol: variable driver
location: class UI.Automation.pageobjects.HomePage
[ERROR] /Users/nehasingh/Downloads/AutomationUI-main/src/main/java/UI/Automation/pageobjects/HomePage.java:[32,35] cannot find symbol
symbol: variable driver
location: class UI.Automation.pageobjects.HomePage
[ERROR] /Users/nehasingh/Downloads/AutomationUI-main/src/main/java/UI/Automation/pageobjects/loginPage.java:[11,17] cannot find symbol
symbol: variable driver
location: class UI.Automation.pageobjects.loginPage
[INFO] 7 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.837 s
[INFO] Finished at: 2021-04-17T00:03:28-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project Automation: Compilation failure: Compilation failure:
[ERROR] /Users/nehasingh/Downloads/AutomationUI-main/src/main/java/UI/Automation/pageobjects/HomePage.java:[10,29] package UI.Automation.stepdfn does not exist
[ERROR] /Users/nehasingh/Downloads/AutomationUI-main/src/main/java/UI/Automation/pageobjects/HomePage.java:[14,31] cannot find symbol
[ERROR] symbol: class Hooks
[ERROR] /Users/nehasingh/Downloads/AutomationUI-main/src/main/java/UI/Automation/pageobjects/loginPage.java:[3,29] package UI.Automation.stepdfn does not exist
[ERROR] /Users/nehasingh/Downloads/AutomationUI-main/src/main/java/UI/Automation/pageobjects/loginPage.java:[5,32] cannot find symbol
[ERROR] symbol: class Hooks
[ERROR] /Users/nehasingh/Downloads/AutomationUI-main/src/main/java/UI/Automation/pageobjects/HomePage.java:[19,49] cannot find symbol
[ERROR] symbol: variable driver
[ERROR] location: class UI.Automation.pageobjects.HomePage
[ERROR] /Users/nehasingh/Downloads/AutomationUI-main/src/main/java/UI/Automation/pageobjects/HomePage.java:[32,35] cannot find symbol
[ERROR] symbol: variable driver
[ERROR] location: class UI.Automation.pageobjects.HomePage
[ERROR] /Users/nehasingh/Downloads/AutomationUI-main/src/main/java/UI/Automation/pageobjects/loginPage.java:[11,17] cannot find symbol
[ERROR] symbol: variable driver
[ERROR] location: class UI.Automation.pageobjects.loginPage
[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
This was working completely fine in Win10 but not working in MacOS.
Versions:
JAVA:16
Maven: 3.8.1
I have this scenarion:
I have a maven project with spring boot where i just have some tipical pojo classes inside this package structure like: com.demo.core
pom structure
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<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>
com/demo/core/Person.java
Then im trying to use that base project as a dependency of other spring boot project which is responsible of database persistence.
here i use spring data, lombok and others.
Second project pom dependencies:
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- local dependencies -->
**
<dependency>
<groupId>com.demo</groupId>
<artifactId>core-baseproject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
**
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
I run mvn clean install in base project and verify that the jar file is in my local .m2 repository structure.
when i try to run mvn clean install in the second project i got an error saying that the package com.demo.core does not exits therefore did not find classes inside that package.
Error details:
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< com.demo:jpa-dataprovider-simple >---------------
[INFO] Building jpa-dataprovider-simple 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # jpa-dataprovider-simple ---
[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) # jpa-dataprovider-simple ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to /home/demo/sts-eclipse-wrkspace-simple/jpa-dataprovider-simple/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/demo/sts-eclipse-wrkspace-simple-pos/jpa-dataprovider-simple-pos/src/main/java/com/demo/jpa/dataprovider/mapper/TerminalConfigJpaMapper.java:[4,35] package com.demo.core.entity does not exist
[ERROR] /home/demo/sts-eclipse-wrkspace-simple-pos/jpa-dataprovider-simple/src/main/java/com/demo/jpa/dataprovider/mapper/TerminalConfigJpaMapper.java:[8,59] cannot find symbol
symbol: class TerminalConfig
location: class com.demo.jpa.dataprovider.mapper.TerminalConfigJpaMapper
[ERROR] /home/demo/sts-eclipse-wrkspace-simple-pos/jpa-dataprovider-simple/src/main/java/com/demo/jpa/dataprovider/mapper/TerminalConfigJpaMapper.java:[18,23] cannot find symbol
symbol: class TerminalConfig
location: class com.demo.jpa.dataprovider.mapper.TerminalConfigJpaMapper
[ERROR] /home/demo/sts-eclipse-wrkspace-simple-pos/jpa-dataprovider-simple/src/main/java/com/demo/jpa/dataprovider/gateway/JpaTerminalConfigGatewayImpl.java:[9,35] package com.demo.core.entity does not exist
[ERROR] /home/demo/sts-eclipse-wrkspace-simple-pos/jpa-dataprovider-simple/src/main/java/com/demo/jpa/dataprovider/gateway/JpaTerminalConfigGatewayImpl.java:[10,36] package com.demo.core.gateway does not exist
[ERROR] /home/demo/sts-eclipse-wrkspace-simple-pos/jpa-dataprovider-simple/src/main/java/com/demo/jpa/dataprovider/gateway/JpaTerminalConfigGatewayImpl.java:[14,54] cannot find symbol
symbol: class TerminalConfigGateway
[ERROR] /home/demo/sts-eclipse-wrkspace-simple/jpa-dataprovider-simple/src/main/java/com/demo/jpa/dataprovider/gateway/JpaTerminalConfigGatewayImpl.java:[24,36] cannot find symbol
symbol: class TerminalConfig
location: class com.demo.jpa.dataprovider.gateway.JpaTerminalConfigGatewayImpl
[ERROR] /home/demo/sts-eclipse-wrkspace-simple-pos/jpa-dataprovider-simple/src/main/java/com/demo/jpa/dataprovider/gateway/JpaTerminalConfigGatewayImpl.java:[24,16] cannot find symbol
symbol: class TerminalConfig
location: class com.demo.jpa.dataprovider.gateway.JpaTerminalConfigGatewayImpl
[INFO] 8 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.714 s
[INFO] Finished at: 2020-01-14T18:08:20-05:00
[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 jpa-dataprovider-simple: Compilation failure: Compilation failure:
[ERROR] /home/demo/sts-eclipse-wrkspace-simple/jpa-dataprovider-simple/src/main/java/com/d/jpa/dataprovider/mapper/TerminalConfigJpaMapper.java:[4,35] package com.demo.core.entity does not exist
[ERROR] /home/demo/sts-eclipse-wrkspace-simple/jpa-dataprovider-simple/src/main/java/com/demo/jpa/dataprovider/mapper/TerminalConfigJpaMapper.java:[8,59] cannot find symbol
[ERROR] symbol: class TerminalConfig
[ERROR] location: class com.demo.jpa.dataprovider.mapper.TerminalConfigJpaMapper
[ERROR] /home/demo/sts-eclipse-wrkspace-simple/jpa-dataprovider-simple/src/main/java/com/demo/jpa/dataprovider/mapper/TerminalConfigJpaMapper.java:[18,23] cannot find symbol
[ERROR] symbol: class TerminalConfig
[ERROR] location: class com.demo.jpa.dataprovider.mapper.TerminalConfigJpaMapper
[ERROR] /home/demo/sts-eclipse-wrkspace-simple/jpa-dataprovider-simple/src/main/java/com/demo/jpa/dataprovider/gateway/JpaTerminalConfigGatewayImpl.java:[9,35] package com.demo.core.entity does not exist
[ERROR] /home/demo/sts-eclipse-wrkspace-simple/jpa-dataprovider-simple/src/main/java/com/demo/jpa/dataprovider/gateway/JpaTerminalConfigGatewayImpl.java:[10,36] package com.demo.core.gateway does not exist
[ERROR] /home/demo/sts-eclipse-wrkspace-simple/jpa-dataprovider-simple/src/main/java/com/demo/jpa/dataprovider/gateway/JpaTerminalConfigGatewayImpl.java:[14,54] cannot find symbol
[ERROR] symbol: class TerminalConfigGateway
[ERROR] /home/demo/sts-eclipse-wrkspace-simple/jpa-dataprovider-simple/src/main/java/com/demo/jpa/dataprovider/gateway/JpaTerminalConfigGatewayImpl.java:[24,36] cannot find symbol
[ERROR] symbol: class TerminalConfig
[ERROR] location: class com.demo.jpa.dataprovider.gateway.JpaTerminalConfigGatewayImpl
[ERROR] /home/demo/sts-eclipse-wrkspace-simple/jpa-dataprovider-simple/src/main/java/com/demo/jpa/dataprovider/gateway/JpaTerminalConfigGatewayImpl.java:[24,16] cannot find symbol
[ERROR] symbol: class TerminalConfig
[ERROR] location: class com.demo.jpa.dataprovider.gateway.JpaTerminalConfigGatewayImpl
[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
Have any one a clue how to solve this???
Im using:
Spring Tool Suite 4
Version: 4.5.0.RELEASE
java-8-openjdk-amd64
maven 3.6.0
springboot version 2.1.11
Thanks in advance.
There is something new to me, when i review inside jar file the structure is like this:
Jar structure generated by spring boot
For some reason i changed the maven config in eclipse to use the installed and not the embedbeb one, but now i get this error.
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.619 s <<< FAILURE! - in com.oxypora.jpa.dataprovider.JpaDataproviderSimplePosApplicationTests
[ERROR] contextLoads(com.oxypora.jpa.dataprovider.JpaDataproviderSimplePosApplicationTests) Time elapsed: 0.015 s <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.oxypora.jpa.dataprovider.JpaDataproviderSimplePosApplication]; nested exception is java.io.FileNotFoundException: class path resource [com/oxypora/pos/core/gateway/TerminalConfigGateway.class] cannot be opened because it does not exist
Caused by: java.io.FileNotFoundException: class path resource [com/oxypora/pos/core/gateway/TerminalConfigGateway.class] cannot be opened because it does not exist
I found another solution when you have two or more springboot projects and you want to wire them one as dependency of others.
The solution is not to use spring-boot-maven-plugin, this plugin override the normal package of the jar causing your classes and package structure to move under BOOT-INF/classes.
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
I solved the problem, springboot project generated a diferent jar structure configured in the metainf file, so that classes are not pleced in the tipical folders.
what i did was to change the core project to a simple maven project with out spring boot complexity, and now the second project (springboot one) compiled without problems.
There was not nescessary to have the base project as a springboot one.
I am new to Maven and I am trying to create a JAR out of a HelloWorld program.
I have done the classpath setting:
This is 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.demo</groupId>
<artifactId>custom-project</artifactId>
<packaging>maven-plugin</packaging>
<version>1.0</version>
<name>custom-project Maven Mojo</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
When I trigger mvn package command, I am getting this error:
[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: 1.700 s
[INFO] Finished at: 2018-04-13T12:25:12+05:30
[INFO] Final Memory: 9M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project custom-project: Compilation f
ailure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR]
[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
JAVA_HOME is already set as C:\Program Files\Java\jdk1.8.0_121\bin in classpath. Please suggest how to resolve this issue.
Your JAVA_HOME is set to a JRE not to a JDK. The JRE does not include the Java Compiler, so set JAVA_HOME to a JDK and it should work
Also you can goto your project properties-> Libraries-> add Library -> JRE system Library -> Alternate JRE -> Add.
and then you choose your JDK path from your system and apply.
Make sure to remove JRE From project library.
In my case, this works well.
You need to tell java what class to run. Depending on the maven plugin you use the ways might be different. This link shows how it can be done with the help of the maven-assembly-plugin https://stackoverflow.com/a/45902851/6825678
This is a really simple question, but I searched for a resolution and nothing is working for me. I added the below to my pom.xml, but can't import org.apache.commons.csv.CSVParser in my class. When I run mvn install, I get the below output.
<dependencies>
....
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.1.1-SNAPSHOT</version>
</dependency>
....
</dependencies>
D:\java\my_project>mvn install
[INFO] Scanning for projects...
[INFO] Building my_project 1.0-SNAPSHOT
[WARNING] The POM for org.apache.commons:commons-csv:jar:1.1.1-SNAPSHOT is missing, no dependency information available
[INFO] BUILD FAILURE
[INFO] Total time: 0.644 s
[INFO] Finished at: 2015-07-21T08:46:47-04:00
[INFO] Final Memory: 8M/245M
[ERROR] Failed to execute goal on project my_project: Could not resolve depen dencies for project com.myproject:artifact:jar:1.0-SNAPSHOT: Could not find artifact org.apache.commons:commons-csv:jar:1.1.1-SNAPSHOT -> [Help 1]
[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] 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 nException
Why are you using the snapshot? The snapshot version is a alpha/beta version, which might be unstable. It's also not uploaded to the standard Maven repo, so you would need to do some extra work to use it. If you use 1.1 it should work.
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.1</version>
</dependency>
Hi I'm trying to use the maven android plugin and robolectric to get tests working. Right now I just have one test class which is under src/test.... I've followed the instructions here to try and get this working: http://pivotal.github.com/robolectric/maven-quick-start.html
UPDATED: I have followed the advice of those who posted to me here and here is my latest Pom.xml and compile output.
Here is my Pom.xml:
<project 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>org.mozilla.android.sync</groupId>
<artifactId>android-sync</artifactId>
<version>1</version>
<packaging>apk</packaging>
<name>sync</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.3.3</version>
<scope>provided</scope>
</dependency>
<!--
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<version>2.3.3</version>
<scope>provided</scope>
</dependency>
-->
<dependency>
<groupId>com.pivotallabs</groupId>
<artifactId>robolectric</artifactId>
<version>1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<!-- try 4.10 once we get this working -->
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<!--<pluginManagement>-->
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<!-- version 2.3 defaults to java 1.5, so no further configuration needed-->
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<!--
<artifactId>maven-android-plugin</artifactId>
<version>2.8.4</version>-->
<artifactId>android-maven-plugin</artifactId>
<version>3.0.0-alpha-13</version>
<configuration>
<sdk>
<!-- platform or api level (api level 4 = platform 1.6)-->
<platform>10</platform>
</sdk>
<emulator>
<!-- the name of the avd device to use for starting the emulator -->
<avd>android-14</avd>
</emulator>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<excludes>
<exclude>**/Test*.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
<!--</pluginManagement>-->
</build>
</project>
Output of mvn clean install:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building sync 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # android-sync ---
[INFO] Deleting /Users/jason/dev/work/android-sync/target
[INFO]
[INFO] --- android-maven-plugin:3.0.0-alpha-13:generate-sources (default-generate-sources) # android-sync ---
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] /Users/jason/dev/android-sdk-mac_x86/platform-tools/aapt [package, -m, -J, /Users/jason/dev/work/android-sync/target/generated-sources/r, -M, /Users/jason/dev/work/android-sync/AndroidManifest.xml, -S, /Users/jason/dev/work/android-sync/res, --auto-add-overlay, -I, /Users/jason/dev/android-sdk-mac_x86/platforms/android-10/android.jar]
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # android-sync ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/jason/dev/work/android-sync/src/main/resources
[INFO] skip non existing resourceDirectory /Users/jason/dev/work/android-sync/target/generated-sources/extracted-dependencies/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # android-sync ---
[INFO] Compiling 21 source files to /Users/jason/dev/work/android-sync/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[6,33] package com.xtremelabs.robolectric does not exist
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[7,16] package org.junit does not exist
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[8,23] package org.junit.runner does not exist
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[10,26] package org.hamcrest does not exist
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[10,0] static import only from classes and interfaces
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[11,23] package org.junit does not exist
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[11,0] static import only from classes and interfaces
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[13,1] cannot find symbol
symbol: class RunWith
#RunWith(RobolectricTestRunner.class)
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[16,5] cannot find symbol
symbol : class Test
location: class org.mozilla.android.sync.test.MyActivityTest
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[19,28] cannot find symbol
symbol : method equalTo(java.lang.String)
location: class org.mozilla.android.sync.test.MyActivityTest
[INFO] 10 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.019s
[INFO] Finished at: Sat Nov 12 13:02:42 PST 2011
[INFO] Final Memory: 12M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project android-sync: Compilation failure: Compilation failure:
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[6,33] package com.xtremelabs.robolectric does not exist
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[7,16] package org.junit does not exist
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[8,23] package org.junit.runner does not exist
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[10,26] package org.hamcrest does not exist
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[10,0] static import only from classes and interfaces
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[11,23] package org.junit does not exist
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[11,0] static import only from classes and interfaces
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[13,1] cannot find symbol
[ERROR] symbol: class RunWith
[ERROR] #RunWith(RobolectricTestRunner.class)
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[16,5] cannot find symbol
[ERROR] symbol : class Test
[ERROR] location: class org.mozilla.android.sync.test.MyActivityTest
[ERROR] /Users/jason/dev/work/android-sync/src/test/java/org/mozilla/android/sync/test/MyActivityTest.java:[19,28] cannot find symbol
[ERROR] symbol : method equalTo(java.lang.String)
[ERROR] location: class org.mozilla.android.sync.test.MyActivityTest
[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
I think you might have that problem due to the order of the test dependency in the pom file. Move the junit one to be the last one or at least behind the robolectric one. That should fix it.
Check out the working robolectric sample app for more comparison.
I did make sure that all dependencies were listed before the android dependencies
Actually the order of dependencies does matter, in the link your provided yourself, see the important comments in the sample pom.xml:
<!-- Make sure this is below the android dependencies -->
<dependency>
<groupId>com.pivotallabs</groupId>
<artifactId>robolectric</artifactId>
<version>X.X.X</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
From my own experiences, I think this library is still in a development stage, their API is not stable and change quite a lot between different version, code working in a old version for example 0.9.4 may not working in 1.0-XX or later. try download/use the latest versrion from there sonatype repository
So I was having the same problems too. For what it's worth, I wasn't using maven or gradle, here's how I fixed this issue.
In your Test class:
Make sure the Roboelectric library is first in the list of dependencies (In IntelliJ, click on your project in the Navigation Pane and hit F4).
import org.junit.runner.RunWith; <- The RunWith annotation is actually part of JUnit.
import org.roboelectric.RoboeletricTestRunner;
I hope this helps!