I am using intellij idea ultimate version 12.1.4 and trying to use maven with a project. Here is my 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>
<parent>
<groupId>com.fasterxml</groupId>
<artifactId>oss-parent</artifactId>
<version>10</version>
</parent>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.2.2</version>
<name>jackson-databind</name>
<description>General data-binding functionality for Jackson: works on core streaming API</description>
<url>http://wiki.fasterxml.com/JacksonHome</url>
<scm>
<connection>scm:git:git#github.com:FasterXML/jackson-databind.git</connection>
<developerConnection>scm:git:git#github.com:FasterXML/jackson-databind.git</developerConnection>
<url>http://github.com/FasterXML/jackson-databind</url>
<tag>jackson-databind-2.2.2</tag>
</scm>
<properties>
<osgi.export>
com.fasterxml.jackson.databind,
com.fasterxml.jackson.databind.annotation,
com.fasterxml.jackson.databind.cfg,
com.fasterxml.jackson.databind.deser,
com.fasterxml.jackson.databind.deser.impl,
com.fasterxml.jackson.databind.deser.std,
com.fasterxml.jackson.databind.exc,
com.fasterxml.jackson.databind.ext,
com.fasterxml.jackson.databind.introspect,
com.fasterxml.jackson.databind.jsonschema,
com.fasterxml.jackson.databind.jsonFormatVisitors,
com.fasterxml.jackson.databind.jsontype,
com.fasterxml.jackson.databind.jsontype.impl,
com.fasterxml.jackson.databind.module,
com.fasterxml.jackson.databind.node,
com.fasterxml.jackson.databind.ser,
com.fasterxml.jackson.databind.ser.impl,
com.fasterxml.jackson.databind.ser.std,
com.fasterxml.jackson.databind.type,
com.fasterxml.jackson.databind.util
</osgi.export>
<osgi.import>
com.fasterxml.jackson.annotation,
com.fasterxml.jackson.core,
com.fasterxml.jackson.core.base,
com.fasterxml.jackson.core.format,
com.fasterxml.jackson.core.json,
com.fasterxml.jackson.core.io,
com.fasterxml.jackson.core.util,
com.fasterxml.jackson.core.type,
org.xml.sax,org.w3c.dom, org.w3c.dom.bootstrap, org.w3c.dom.ls,
javax.xml.datatype, javax.xml.namespace, javax.xml.parsers
</osgi.import>
<!-- Generate PackageVersion.java into this directory. -->
<packageVersion.dir>com/fasterxml/jackson/databind/cfg</packageVersion.dir>
<packageVersion.package>com.fasterxml.jackson.databind.cfg</packageVersion.package>
</properties>
<dependencies>
<!-- Builds on core streaming API; also needs core annotations -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.2.2</version>
</dependency>
<!-- and for testing, JUnit is needed, as well as quite a few
libs for which we use reflection for code, but direct dep for testing
-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<version>1.7.9</version>
<scope>test</scope>
</dependency>
<dependency> <!-- from core we just test for repackaged cglib, not hibernate proper -->
<groupId>org.hibernate</groupId>
<artifactId>hibernate-cglib-repack</artifactId>
<version>2.1_3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
<excludes>
<exclude>com/fasterxml/jackson/failing/*.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${javadoc.version}</version>
<configuration>
<links>
<link>http://docs.oracle.com/javase/6/docs/api/</link>
<link>http://fasterxml.github.com/jackson-annotations/javadoc/2.1.1/</link>
<link>http://fasterxml.github.com/jackson-core/javadoc/2.1.1/</link>
</links>
</configuration>
</plugin>
<plugin>
<!-- Inherited from oss-base. Generate PackageVersion.java.-->
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<executions>
<execution>
<id>process-packageVersion</id>
<phase>process-sources</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<properties>
<maven.test.skip>true</maven.test.skip>
<skipTests>true</skipTests>
</properties>
</profile>
</profiles>
</project>
When I do a maven dependency resolution, its taking forever to get it through and this is what I get:
And it sticks here forever.
Here are my maven settings:
I followed steps given in this SO answer.
Please let me know where am I doing wrong and how do I get rid of it.
EDIT
If this should help, I am trying to run this code: https://github.com/hmkcode/Android/tree/master/java-post-gcm
I am not sure whether its an issue with the pom.xml itself. Perhaps if someone is able to have it working on his IDE, it may be concluded that its an issue with my specific IDE config.
If this is an issue very specific to intellij, I would suggest do the following steps
You can try running mvn clean install.(Depending on your network speed it will pull every dependency)
Change intellij settings in
Preferences->build,execution,deployment->maven->Maven home directory->{now change this to point to your mvn home rather than bundled mvn}
mvn -v in command line should give you the maven home path.
Now it won't try to download dependencies again.
File | Settings | Build, Execution, Deployment | Build Tools | Maven |
Threads (-T option) | 8 (or however many threads you want to try)
mvn compile -T 8
I had the same issue. Maven was taking an hour in IntelliJ and also running from the command line. Using the -T parameter you can tell Maven to use more threads to download artifacts simultaneously. Takes only about 15 minutes now.
Don't use bundled mvn. Point "Maven home directory" to the path on your file system.
After you're done building. Check "Work offline". This stops mvn from searching remote websites each time you build. Uncheck when you update your POM file so it can search for the changes.
You can also skip tests. This is evertyhing from the command line.
mvn clean install -T 8 -o -DskipTests
Select File, Settings, then set VM options for Maven importing to -Xms1024m -Xmx2048m.
Visit https://www.programmersought.com/article/56414660398/
For me, issue was related to https://repo.maven.apache.org/maven2 and it was not responding.
I added another mirror(maven-central.storage.googleapis.com) in settings.xml
Related
I want to create a executable jar file so anyone can run it from their computer with least install require components.
I found several tutorial but none of them a work.
When I execute jar file I've built they are return error like:
Error: Could not find or load main class fully.qualified.MainClass
Caused by: java.lang.ClassNotFoundException: fully.qualified.MainClass
OR like this:
Error: Could not find or load main class io.cucumber.core.cli.Main
Caused by: java.lang.ClassNotFoundException: io.cucumber.core.cli.Main
My project run from Intellij with no problem.
Here my project structure
https://i.stack.imgur.com/NcQzf.png
And my 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>com.example</groupId>
<artifactId>CucumberSelenium</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cucumber.version>7.6.0</cucumber.version>
<selenium.version>4.8.0</selenium.version>
<webdrivermanager.version>5.2.1</webdrivermanager.version>
<junit.jupiter.version>5.9.0</junit.jupiter.version>
<apache.common.version>2.4</apache.common.version>
<projectlombok.version>1.18.24</projectlombok.version>
<maven.compiler.plugin.version>3.10.1</maven.compiler.plugin.version>
<maven.surefire.plugin.version>3.0.0-M7</maven.surefire.plugin.version>
<maven.compiler.source>19</maven.compiler.source>
<maven.compiler.target>19</maven.compiler.target>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-bom</artifactId>
<version>${cucumber.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>${junit.jupiter.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit-platform-engine</artifactId>
<scope>test</scope>
</dependency>
<!-- JUnit Platform -->
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<!-- Selenium -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
</dependency>
<!-- Web Driver Manager -->
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>${webdrivermanager.version}</version>
</dependency>
<!-- Apache Common -->
<dependency>
<groupId>org.apache.directory.studio</groupId>
<artifactId>org.apache.commons.io</artifactId>
<version>${apache.common.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${projectlombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.4.2</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>19</source>
<target>19</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin.version}</version>
<configuration>
<properties>
<configurationParameters>
cucumber.junit-platform.naming-strategy=long
</configurationParameters>
</properties>
<debugForkedProcess>true</debugForkedProcess>
<forkCount>0</forkCount>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<archive>
<manifest>
<mainClass>io.cucumber.core.cli.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I've run mvn clean compile assembly:single, it's output a CucumberSelenium-1.0-SNAPSHOT-jar-with-dependencies.jar file, but it wont runs.
I just came across a similar issue and, despite trying the ubiquitous
java -cp . org.example.Main
(while on current directory being where the Main.class is), I kept getting this dreaded
"Error: Could not find or load main class"
I eventually resorted to comparing the actual command with parameters invoked by IntelliJ (on IntelliJ IDEA's debug log) with mine, and discovered that the following solves the issue:
java -cp C:\Users\WebViwer\IdeaProjects\MyProj\target\classes org.example.Main
I am guessing that once the fully qualified class name is specified, the current directory (where the class resides) is no longer valid as a classpath: Only the top level classes directory should be specified (in this org.example, 2 levels up).
You have a a few problems going on.
The maven-assembly-plugin should not be a in the dependencies section. It is not a dependency used by the runtime code of your project.
Your step definitions, feature files and glue code located in src/test are not included in the jar file build by the assembly plugin.
Your test scoped dependencies will also not be included by the assembly plugin either.
You must configure the containerDescriptorHandler of the assembly plugin with metaInf-services or the plugin will not merge files in META-INF/services correctly.
You can verify most of these by opening the generated jar file (it's a .zip file in disguise).
My project run from Intellij with no problem.
When running tests in Intelij you are using the test scope, the jar file only includes runtime scoped code.
For a more comparable test you must create a new run configuration that invokes the main method.
I found several tutorial but none of them a work.
It appears that you are relatively new to Java and Maven. It would be prudent to follow a proper course first rather than tutorials. You are missing fundamental knowledge that is generally not taught in tutorials.
I want to create a executable jar file so anyone can run it from their computer with least install require components.
It's also prudent to consider why you are doing this.
Tests will typically change as quickly as the source code they are testing does. Manually distribution of jar files won't keep up with this.
This means it's generally better to integrate the tests and the test source code into the automated build pipeline of the project they test.
This also means that you don't need to distribute your tests as a jar. Rather you should expect (and possibly train) people to use Maven, GIT and Java.
I have a java azure function that was running package azure-functions-maven-plugin version 1.3, trying to upgrade the package to anything 1.4 or greater when I try to package the function I get the following error:
Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.12.0:package (package-functions) on project azure-functions-archetype: com.google.gson.stream.MalformedJsonException: Expected name at line 9 column 4 path $.extensions.http
My 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>com.microsoft.azure</groupId>
<artifactId>azure-functions-archetype</artifactId>
<version>1.38</version>
<packaging>jar</packaging>
<dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-documentdb</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>adal4j</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>7.0.0.jre8</version>
</dependency>
</dependency>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId>
<version>1.12.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId>
<configuration>
<resourceGroup>java-functions-group</resourceGroup>
<appName>${functionAppName}</appName>
<region>${functionAppRegion}</region>
<appSettings>
<property>
<name>FUNCTIONS_EXTENSION_VERSION</name>
<value>~3</value>
</property>
</appSettings>
</configuration>
<executions>
<execution>
<id>package-functions</id>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
```
I m unable to find a solution online on what is causing this error, hoping someone out there has an idea
Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.12.0:package (package-functions) on project azure-functions-archetype: com.google.gson.stream.MalformedJsonException:
It seems to be the issue in pom.xml code like either the tags are misspelled or the azure functions maven plugin code is missing or written wrong.
There is a similar issue here resolved by specifying the runtime and correcting the misspelt tags/code.
Also, Please make changes in your pom.xml file by comparing with my pom.xml as I see in the given pom.xml is missing the azure.functions.maven.plugin.version, runtime OS property etc. (https://i.imgur.com/uVkrUfU.png, https://i.imgur.com/ccu4BrW.png).
Reference: pom.xml code
I tried to run the Azure Functions Project (Java Stack) in VS Code and it come up with many issues regarding to loading the dependencies, Java Compiler Packages etc. and finally running the function successfully by following the below steps:
Maven version 3.8.4
Azure Functions Maven Plugin 1.15
Process 1:
Created the Azure Java Functions Project through VS Code and run the function successfully:
Process 2:
Created azure functions project using maven-archetype-quickstart template and is working good.
Run this command in your VS Code terminal:
mvn archetype:generate -DgroupId=com.microsoft.azure -DartifactId=azure-functions-archetype -DinteractiveMode=false
Since archetypes are templates and they intend to reflect current best practices, they can evolve in time, thus they have their own versions. Maven will ask you which version of the archetype you want to use. By default, maven chooses latest version for you. so if you agree to use the latest version of an archetype, just press Enter at this step;
Every maven project (and module) has its groupId, artifactId and version. Maven will then ask these to you in three steps. groupId: This is generally unique amongst an organization or a project. artifactId: The artifactId is generally the name that the project is known by. version: This is the last piece of the naming puzzle.(read more)
Finally, maven will ask you the package structure for your code. A best practice is to create your folder structure that reflects the groupId, thus Maven sets this as default but you are free to change this.
After entering these information, Maven will show you all the information you entered and ask you to verify project creation. If you press Y and then enter, voila your project is created with the artifact and settings you chose.
You can also read maven-archetype-plugin's usage site.
To Update the pom.xml versions, please run the commands (in your VS Code Project terminal) available in this Maven official site.
I have a GWT project that I currently compile using Eclipse GWT plugin, but now I would like to make my project compilable independently from the IDE, and the approach is to use Maven only.
From my research I found out that you need to add the GWT Compiler plugin to the pom.xml in order to compile the code from Java to Javascript files (the JS files can be later packaged inside a war), but I can't seem to find the compiler dependency in maven repository nor a good documentation of the compiler. Can you post a "basic" working pom.xml file that can be used to compile a Hello world GWT project, that would be very appreciated, Thank you.
EDIT:
I'm using GWT 2.7.0
You can use the gwt-maven-plugin. You have mentioned you have the Eclipse GWT plugin already, so you can create a new GWT project (e.g. right click on the Project Explorer -> New -> Other... -> GWT Web Application Project). Fill in the project name and package and make sure to enable the checkbox "Generate a Maven Project". Then you have a working sample of a 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">
<!-- POM file generated with GWT webAppCreator -->
<modelVersion>4.0.0</modelVersion>
<groupId>com.world.hello</groupId>
<artifactId>HelloWorld</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>com.world.hello.HelloWorld</name>
<properties>
<!-- Setting maven.compiler.source to something different to 1.8
needs that you configure the sourceLevel in gwt-maven-plugin since
GWT compiler 2.8 requires 1.8 (see gwt-maven-plugin block below) -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- Don't let your Mac use a crazy non-standard encoding -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencyManagement>
<dependencies>
<!-- ensure all GWT deps use the same version (unless overridden) -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt</artifactId>
<version>2.9.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Output classes directly into the webapp, so that IDEs and "mvn process-classes" update them in DevMode -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin-->
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.0-rc-8</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<moduleName>com.world.hello.HelloWorld</moduleName>
<moduleShortName>HelloWorld</moduleShortName>
<failOnError>true</failOnError>
<!-- GWT compiler 2.8 requires 1.8, hence define sourceLevel here if you use
a different source language for java compilation -->
<sourceLevel>1.8</sourceLevel>
<!-- Compiler configuration -->
<compilerArgs>
<!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) -->
<arg>-compileReport</arg>
<arg>-XcompilerMetrics</arg>
</compilerArgs>
<!-- DevMode configuration -->
<warDir>${project.build.directory}/${project.build.finalName}</warDir>
<classpathScope>compile+runtime</classpathScope>
<!-- URL(s) that should be opened by DevMode (gwt:devmode). -->
<startupUrls>
<startupUrl>HelloWorld.html</startupUrl>
</startupUrls>
</configuration>
</plugin>
<!-- Skip normal test execution, we use gwt:test instead -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
Running mvn clean install on the console will compile your project using Maven. Or you right click your project on the Project Explorer and select Maven -> Update Project...
Sometimes, after creating the GWT Maven Project, Eclipse doesn't automatically recognize it as a Maven Project. If that is the case, right click your project on the Project Explorer and select Configure -> Convert to Maven Project.
I'm having issues with my Maven project. I am trying to use the command "mvn clean install" but I'm having no success. I have updated & cleaned the Maven project in the Eclipse IDE. I have also deleted the folder "repository" within the ".m2" directory. This creates the folder again but I keep getting the same error:
My pom.xml file:
<properties>
<version.thorntail>2.2.0.Final</version.thorntail>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<failOnMissingWebXml>false</failOnMissingWebXml>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>bom-all</artifactId>
<version>${version.thorntail}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<finalName>demo</finalName>
<plugins>
<plugin>
<groupId>io.thorntail</groupId>
<artifactId>thorntail-maven-plugin</artifactId>
<version>${version.thorntail}</version>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jaxrs</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>cdi</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-mongodb</artifactId>
<version>5.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.8.0</version>
</dependency>
</dependencies>
Any help would be greatly apreciated!
The problem is the Maven version (BTW which one are you using?)
When I run my Thorntail project using eclipse's embedded maven (version 3.5.3 ) it works.
When I run it using my local maven (version 3.6.0) I get the same error.
Solution: use a compatible version of maven. ( try 3.5.3 or 3.5.4) both work without issues with thorntail.
If you want to configure a different eclipse maven version go to:
Eclipse -> preferences -> Maven -> installations
there you can add a new one.
There's a problem due to third-party dependencies in Thorntail 2.x, that are incompatible with latest Maven release. The new Thorntail version should be the 2.3.0.Final once released.
On GitHub, you can track the status of the issue here
I know this is a duplicate question but the answers on other topics didn't help me.
I'm using Eclipse Photon, Java Version :10, I've set jdk/jre versions on 10 in eclipse and pom.xml file. I've changed eclipse.ini file :
-Dosgi.requiredJavaVersion=10 (it was set to 1.8)
and also I've added plugin in my pom.xml :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>10</source>
<target>10</target>
</configuration>
</plugin>
Nothing helped. This 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.luv2code</groupId>
<artifactId>spring-security-demo-06-user-roles</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>spring-security-demo</name>
<properties>
<maven.compiler.source>10</maven.compiler.source>
<maven.compiler.target>10</maven.compiler.target>
</properties>
<dependencies>
<!-- Spring Security -->
<!-- Spring Security WEB -->
<!-- Spring Security taglibs -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>
<!-- Spring MVC support -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.1.2.RELEASE</version>
</dependency>
<!-- Servlet, JSP and JSTL support -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<!-- TO DO: Add support for Maven WAR Plugin -->
<build>
<finalName>spring-security-demo</finalName>
<pluginManagement>
<plugins>
<plugin>
<!-- Add Maven coordinates forL maven-war-plugin -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>10</source>
<target>10</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
The dependencies aren't being read in class files and also I've tried deleting .m2 repository and starting Eclipse and doing the : Maven->Clean, Maven->install, and than Maven->update project. Nothing helped. I'm really stuck here for about 2-3 hours now.
Note: in Windows->Preferences->installed JRE's the jre10 was marked with the tick. I changed it to mark the jdk10. but still error :
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project spring-security-demo-06-user-roles: Compilation failure
Everything was working fine until I added the dependency of : spring-security-taglibs.
Deleting the dependency doesn't do anything aswell.
Check properly settings with version of your project in eclipse and version of your runner for maven.
I have reproduced the same issue with maven-compiler plugin, but using version 3.8.1:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project testName: Fatal error compiling
My POM was:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
To clarify:
in project I'm using Java 11 and IntelijIDEA (but logic I think the same for eclipse). So I'm using maven lifecycle phases fine only if my version of project (check properly Project Structure -> Project Settings) corresponds to version of maven runner.
E.g. if version of runner is for java 8, but project settings are for Java 11 then I'm getting this error. If I have the same for both then I don't have any problems.
And I highly recommend to check all settings for maven and the whole project. It helps to avoid the issues in the future. Deleting folder for maven is as alternative solution, but it must be last thing that you need to do.
It started working Automagically . FIX : delete .m2 repository.
I did that yesterday but it didn't help, today somehow, deleting the .m2 repository and updating the project helped !
Confirm, delete your entire local repository pointed to by .m2/settings.xml, usually this is .m2/repository
I updated my Java SDK to 11.9 and reloaded the project. With this I solved my problem.
I had the same issue, it was because the Spring Boot project was using Java 11 but my %JAVA_HOME% variable was pointing to Java 8 home directory. I resolved the issue by changing the path to %JAVA_HOME% variable.
You just need to go to preference(eclipse in this case) and change the right version of JDK like below in pic: