I'm developing an editor plug-in in Eclipse Neon. The project is separated into a parent project, managing it's dependencies and a child project, which contains the actual source code. After migrating my plug-in from Eclipse Mars to Neon, I changed the method IEditorDescriptor editorDescriptor = IDE.getEditorDescriptor(storage.getName(), true); to IEditorDescriptor editorDescriptor = IDE.getEditorDescriptor(storage.getName(), true, true);, because the first one is deprecated now. If I try to rebuild the project with Maven, it gives me a compilation failure:
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.22.0:compile (default-compile) on project language-editor-core: Compilation failure: Compilation failure:
[ERROR] C:\Users\X\Documents\tfeditor\language-editor-core\src\main\java\de\se_rwth\langeditor\texteditor\hyperlinks\HyperlinkDetectorImpl.java:[228]
[ERROR] IEditorDescriptor editorDescriptor = IDE.getEditorDescriptor(storage.getName(), true, true);
[ERROR] ^^^^^^^^^^^^^^^^^^^
[ERROR] The method getEditorDescriptor(String, boolean) in the type IDE is not applicable for the arguments (String, boolean, boolean)
[ERROR] 1 problem (1 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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :language-editor-core
The pom.xml of the parent project is this one:
<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>de.monticore</groupId>
<artifactId>language-editor</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Language Editor</name>
<organization>
<name>Department of Software Engineering, RWTH Aachen University</name>
<url>http://www.se-rwth.de/</url>
</organization>
<packaging>pom</packaging>
<modules>
<module>language-editor-core</module>
<module>cdtrans-editor</module>
<module>matrans-editor</module>
<module>language-editor-updatesite</module>
</modules>
<properties>
<monticore.version>4.5.0</monticore.version>
<monticoreRuntime.version>4.5.0</monticoreRuntime.version>
<cd4a.version>1.3.7-SNAPSHOT</cd4a.version>
<cd4a-trans.version>0.0.3-SNAPSHOT</cd4a-trans.version>
<typestrans.version>0.0.3-SNAPSHOT</typestrans.version>
<literalstrans.version>0.0.3-SNAPSHOT</literalstrans.version>
<tfruntime.version>4.4.0-SNAPSHOT</tfruntime.version>
<odrules.version>4.4.0-SNAPSHOT</odrules.version>
<secommons.version>1.7.7</secommons.version>
<antlr.version>4.5</antlr.version>
<guava.version>18.0</guava.version>
<matrans.version>0.0.2.E-SNAPSHOT</matrans.version>
<macommontrans.version>0.0.2-SNAPSHOT</macommontrans.version>
<tycho.version>0.22.0</tycho.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<wagon.version>1.0</wagon.version>
<compiler.plugin>3.3</compiler.plugin>
<java.version>1.8</java.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>de.se_rwth.commons</groupId>
<artifactId>se-commons-utilities</artifactId>
<version>${secommons.version}</version>
</dependency>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>monticore-runtime</artifactId>
<version>${monticoreRuntime.version}</version>
</dependency>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>monticore-grammar</artifactId>
<version>${monticore.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang</groupId>
<artifactId>cd4analysis</artifactId>
<version>${cd4a.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang</groupId>
<artifactId>cd4a-trans</artifactId>
<version>${cd4a-trans.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang</groupId>
<artifactId>literalstrans</artifactId>
<version>${literalstrans.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang</groupId>
<artifactId>typestrans</artifactId>
<version>${typestrans.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.tf</groupId>
<artifactId>de.monticore.tf.runtime</artifactId>
<version>${tfruntime.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.tf</groupId>
<artifactId>de.monticore.tf.odrules</artifactId>
<version>${tfruntime.version}</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4</artifactId>
<version>${antlr.version}</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>${antlr.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.tf</groupId>
<artifactId>matrans</artifactId>
<version>${matrans.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.tf</groupId>
<artifactId>macommontrans</artifactId>
<version>${macommontrans.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<target>
<artifact>
<groupId>de.se_rwth.eclipse</groupId>
<artifactId>de.se_rwth.eclipse.targetplatform.luna</artifactId>
<version>1.0.2-SNAPSHOT</version>
</artifact>
</target>
<pomDependencies>consider</pomDependencies>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>${wagon.version}</version>
<executions>
<execution>
<id>deploy-repository</id>
<phase>deploy</phase>
<goals>
<goal>upload-single</goal>
</goals>
<configuration>
<fromFile>${project.build.directory}/${project.build.finalName}.zip</fromFile>
<serverId>se-nexus</serverId>
<url>https://nexus.se.rwth-aachen.de/service/local/repositories/monticore-snapshots/content-compressed</url>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.0.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<distributionManagement>
<repository>
<id>se-nexus</id>
<url>http://nexus.se.rwth-aachen.de/content/repositories/monticore-releases/</url>
</repository>
<snapshotRepository>
<id>se-nexus</id>
<url>http://nexus.se.rwth-aachen.de/content/repositories/monticore-snapshots/</url>
</snapshotRepository>
<site>
<id>se-nexus</id>
<url>dav:http://nexus.se.rwth-aachen.de/content/sites/se-sites/monticore/${project.version}/</url>
</site>
</distributionManagement>
<repositories>
<repository>
<id>se-public</id>
<url>http://nexus.se.rwth-aachen.de/content/groups/public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>se-public</id>
<url>http://nexus.se.rwth-aachen.de/content/groups/public</url>
</pluginRepository>
</pluginRepositories>
</project>
The specific line in the code is not marked as wrong by Eclipse and the execution of the code also works well, so where is the problem?
Indeed, after adding the Eclipse Neon repository to the pom.xml with this:
<repositories>
<repository>
<id>eclipse-neon</id>
<url>http://download.eclipse.org/releases/neon</url>
<layout>p2</layout>
</repository>
</repositories>
, the Maven build works and does not mark the editorDescriptor = IDE.getEditorDescriptor(storage.getName(), true, true); as an error -> Problem solved
do a
mvn clean
and try to build once more
Related
I am new to Java/Maven, and I am trying to build a maven Spring Boot project, it was earlier working and was successfully creating jar package as well. But it suddenly stopped working and started giving Maven Compile error.
I know it has something to do with the pom.xml file. My best guess : Some changes in this file has caused it to fail.
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>
<groupId>com.loanglide</groupId>
<artifactId>drools-helloworld</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>drools-helloworld</name>
<description>Springboot application</description>
<properties>
<maven.compiler.source>12.0.1</maven.compiler.source>
<maven.compiler.target>12.0.1</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<kie.version>6.1.0.Final</kie.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>1.1.1.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-ci</artifactId>
<version>6.1.0.Final</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.freemarker/freemarker -->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.28</version>
<exclusions>
<exclusion>
<groupId>freemarker<!-- Legacy org-less group --></groupId>
<artifactId>freemarker</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</build>
</project>
Error
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.905 s
[INFO] Finished at: 2019-08-08T01:52:48+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project springboot-helloworld: Fatal error compiling: error: invalid target release: 12.0.1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Java Version
java version "12.0.1" 2019-04-16
Java(TM) SE Runtime Environment (build 12.0.1+12)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)
I have tried many stackoverflow answer to similar question, but still not able to resolve this issue.
If you are using Java 12, add the following to Maven pom.xml.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>12</release>
</configuration>
</plugin>
The properties maven.compiler.source and maven.compiler.target are used by many plugins on default lifecycle, as compiler, as you can see at this answer.
You must try:
<properties>
<maven.compiler.source>12</maven.compiler.source>
<maven.compiler.target>12</maven.compiler.target>
</properties>
But if you want to override only this goal, you can configure it like:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>12</release>
</configuration>
</plugin>
As you are new with Java, keep in mind the new versioning schema so even you have installed the 12 version you can target the 11 LTS target if no new language feature is intended to be used.
I have been trying to build a code using Springtools. But I am stuck with an error.
My system configurations as shown by maven is followning:
>Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T15:49:05-04:00)
>Maven home: C:\Users\Felipe\Documents\Proyecto\backend\module-ebs\EMBEDDED
Java version: 1.8.0_201, vendor: Oracle Corporation
>Java home: C:\Program Files\Java\jre1.8.0_201
>Default locale: en_US, platform encoding: Cp1252
>OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Following is the Maven trace for the error:
[ERROR] Failed to execute goal on project module-ebs: Could not resolve >dependencies for project com.mexperience:module-ebs:jar:0.0.1-SNAPSHOT: Could >not find artifact com.mexperience:module-core:jar:0.0.1-SNAPSHOT -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute >goal on project module-ebs: Could not resolve dependencies for project >com.mexperience:module-ebs:jar:0.0.1-SNAPSHOT: Could not find artifact >com.mexperience:module-core:jar:0.0.1-SNAPSHOT
at >org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:269)
at >org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:147)
at >org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:246)
at >org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200)
at >org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at >org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at >org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at >org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at >org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at >org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at >org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at >org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at >org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at >org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.mexperience:module-ebs:jar:0.0.1-SNAPSHOT: Could not find artifact com.mexperience:module-core:jar:0.0.1-SNAPSHOT
at >org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:208)
at >org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:243)
... 23 more
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact com.mexperience:module-core:jar:0.0.1-SNAPSHOT
at >org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:355)
at >org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:202)
... 24 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact com.mexperience:module-core:jar:0.0.1-SNAPSHOT
at >org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:422)
at >org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:224)
at >org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:338)
... 25 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact com.mexperience:module-core:jar:0.0.1-SNAPSHOT
at >org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:412)
... 27 more
[ERROR]
[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
and this is the pom.xml
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
pom
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.mexperience</groupId>
<artifactId>backend</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>backend</name>
<modules>
<module>module-core</module>
<module>module-ebs</module>
<module>module-resource</module>
</modules>
<properties>
<java.version>1.8</java.version>
<maven.test.skip>true</maven.test.skip>
<docker.registry>docker.mexperiencia.io</docker.registry>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</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>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.mexperience</groupId>
<artifactId>module-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.mexperience</groupId>
<artifactId>module-ebs</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.mexperience</groupId>
<artifactId>module-resource</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--Docker-->
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.27.2</version>
<extensions>true</extensions>
<configuration>
<images>
<image>
<name>${docker.registry}/${project.groupId}.${project.artifactId}</name>
<build>
<from>openjdk:8-alpine</from>
<tags>
<tag>latest</tag>
</tags>
<env>
</env>
<entryPoint>
<exec>
<arg>java</arg>
<arg>-jar</arg>
<arg>-Xmx768m</arg>
<arg>-Xms768m</arg>
<arg>/root/${project.build.finalName}.jar</arg>
</exec>
</entryPoint>
<assembly>
<targetDir>/root</targetDir>
<mode>dir</mode>
<descriptorRef>artifact</descriptorRef>
</assembly>
<ports>
<port>8080</port>
</ports>
</build>
<run>
<!--<memory>1073741824</memory>-->
<!--<volumes>-->
<!--<bind>-->
<!--<volume></volume>-->
<!--</bind>-->
<!--</volumes>-->
</run>
</image>
</images>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<!-- <repositories>-->
<!-- <repository>-->
<!-- <id>project-repository</id>-->
<!-- <url>file://${project.basedir}/.project-repository</url>-->
<!-- </repository>-->
<!-- </repositories>-->
I follow the instructions indicated in this article:
https://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
But it didn´t work. I also executed mvn clean install but doesn´t work either.
What I can do=?
I have a project. Originally it was a single module project with structure like this
java-cloud-sample\
src\
main\
java
pom.xml
I decided to make it into a multi-module structure - I use java 9 anyway.
So I separated it like this
java-cloud-sample\
java-cloud-rest-api\
src\
pom.xml
pom.xml
Where root pom.xml looks like this
<?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.lapots.breed.platform.cloud</groupId>
<artifactId>java-cloud-sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>java-cloud-rest-api</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.9</maven.compiler.source>
<maven.compiler.target>1.9</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals><goal>copy-dependencies</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
And module pom.xml looks like this
<?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.lapots.breed.platform.cloud</groupId>
<artifactId>java-cloud-sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>java-cloud-rest-api</artifactId>
<description>Demo project for Spring Boot</description>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</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>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>
<encoding.source>${project.build.sourceEncoding}</encoding.source>
<encoding.reporting>${project.reporting.outputEncoding}</encoding.reporting>
<java.source>${maven.compiler.source}</java.source>
<java.target>${maven.compiler.target}</java.target>
</additionalProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
But when I try to run mvn clean package I get
INFO] java-cloud-rest-api ................................ FAILURE [ 1.060 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.104 s
[INFO] Finished at: 2017-09-08T17:15:46+03:00
[INFO] Final Memory: 27M/331M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.2:compile (default-compile) on project java-cloud-rest-api: Fatal error compiling: invalid flag: --module-path -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :java-cloud-rest-api
What is the problem? (maybe I should split maven project into separate modules and each maven module split into java modules)
This failure occurs when maven installed on your machine is configured with java8 as the default java version. You can confirm this by executing
mvn -version
on your terminal and checking the Java version stated in the configuration.
To resolve the version to a newer and supported version like java9 at the moment, you can create/edit the mavenrc(on MacOS) file on your machine:
vi ~/.mavenrc
to include these
export PATH
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/
export PATH=${PATH}:$JAVA_HOME/bin
Once you save this configuration, you can confirm maven should be using Java version 9 using the same command and then your project shall build without the stated error.
I had this error with the Maven compiler plugin 3.8.1 when a project was defining a module-info.java and Java 8 was used with Maven to compile the project. It seems that as soon a module-info.java is seen by the Maven compiler plugin it is adding the flag --module-path to the command line which is unknown to the Java 8 compiler. A way to exclude this file and compile the project without module support is to exclude the module-info.java from compilation based on a Maven profile:
<profiles>
<profile>
<id>java8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<excludes>
<exclude>module-info.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
I try to follow : Hosting a Maven repository on github
My POM.xml
<parent>
<artifactId>rf</artifactId>
<groupId>com.zlhades</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>rfcore</artifactId>
<properties>
<java-version>1.7</java-version>
<github.global.server>github</github.global.server>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.12</version>
<configuration>
<message>Maven artifacts for ${project.version}</message> <!-- git commit message -->
<noJekyll>true</noJekyll> <!-- disable webpage processing -->
<outputDirectory>${project.build.directory}/mvn-repo</outputDirectory> <!-- matches distribution management repository url above -->
<branch>refs/heads/mvn-repo</branch> <!-- remote branch name -->
<includes><include>**/*</include></includes>
<repositoryName>RequestForward</repositoryName> <!-- github repo name -->
<repositoryOwner>zlhades</repositoryOwner> <!-- github username -->
</configuration>
<executions>
<!-- run site-maven-plugin's 'site' target as part of the build's normal 'deploy' phase -->
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>internal.repo</id>
<name>Temporary Staging Repository</name>
<url>file://${project.build.directory}/mvn-repo</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>2.0.2-beta</version>
<scope>test</scope>
</dependency>
</dependencies>
And I got below error:
=========================log==========================
[ERROR] Failed to execute goal
com.github.github:site-maven-plugin:0.12:site (default) on project
rfcore: Error creating commit: Invalid request.
[ERROR] For 'properties/name', nil is not a string.
[ERROR] For 'properties/name', nil is not a string. (422)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal com.github.github:site-maven-plugin:0.12:site (default)
on project rfcore: Error creating commit: Invalid request.
For 'properties/name', nil is not a string.
For 'properties/name', nil is not a string. (422)
=========================log==========================
How to fix this issue?
Thx, I found the answer:
The comment at the bottom of this post suggests that you need to have filled in the Real Name field in your github profile to avoid this error.
https://malalanayake.wordpress.com/2014/03/10/create-simple-maven-repository-on-github/
I am upgrading my system's Maven runtime from 3.0.5 to 3.1.1 and trying to build my project using mvn clean install like I normally would. Using the older Maven runtime, the build would always succeed. However, I am now always getting this error message during the build:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor (default-descriptor) on project XYZ: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor failed: 48188 -> [Help 1]
I thought that perhaps it was due to my dependencies and plugins being outdated, so I ran mvn versions:use-latest-versions to update my pom.xml versions. That still did not fix this issue. Any ideas?
UPDATE
By popular demand, here is what my pom.xml file looks like. Note that all dependency and plugin versions were updated by mvn versions:use-latest-versions except for Sitebricks and qdox, due to breaking changes that I didn't want to integrate into my project.
<?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.my.company</groupId>
<artifactId>my-own-project</artifactId>
<version>1.0.1-SNAPSHOT</version>
<name>My Cool Maven Plugin</name>
<packaging>maven-plugin</packaging>
<distributionManagement>
<repository>
<id>someID</id>
<url>http://some.url.com</url>
</repository>
</distributionManagement>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.20</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.11</version>
</dependency>
<dependency>
<groupId>com.google.sitebricks</groupId>
<artifactId>sitebricks</artifactId>
<version>0.8.5</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.qdox</groupId>
<artifactId>qdox</artifactId>
<version>1.12</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.7</version>
<scope>test</scope>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<effort>Max</effort>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
</reporting>
</project>
Upgrading and using below dependency with config resolved my issue:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<!-- see http://jira.codehaus.org/browse/MNG-5346 -->
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
I had exactly the same problem and tried probably every hint provided in the possible duplicate Basic maven plugin project not working, Mojo plugin descriptors not generating, but nothing worked. Eventually in turned out that an old version 2.6.1 of the library com.ibm.icu:icu4j that was used by some other 3rd party module was responsible. I got rid of the icu4j dependency entirely and maven-plugin-plugin run with out problems thereafter.