Error: 'dependencies.dependency.version' must be a valid version but is - maven

I have this parent POM file (hawaii-banner\pom.xml):
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>base</artifactId>
<groupId>org.sakaiproject</groupId>
<version>2.9.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
<name>University of Hawaii Banner</name>
<groupId>edu.hawaii.sakai</groupId>
<artifactId>hawaii-banner</artifactId>
<version>${hawaii.banner.version}</version>
<packaging>pom</packaging>
<properties>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<hawaii.banner.version>2.5.0</hawaii.banner.version>
<uh-gatech.version>2.5.1</uh-gatech.version>
</properties>
<dependencies>
<dependency>
<groupId>org.sakaiproject.kernel</groupId>
<artifactId>sakai-kernel-api</artifactId>
<version>${sakai.kernel.version}</version>
</dependency>
<dependency>
<groupId>org.sakaiproject.kernel</groupId>
<artifactId>sakai-kernel-util</artifactId>
<version>${sakai.kernel.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<!-- Exclude by default the tests that use remote systems. -->
<excludes>
<exclude>**/*Test.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<modules>
<module>api</module>
<module>impl</module>
<module>integration-test</module>
<module>pack</module>
<module>sections-impl</module>
</modules>
</project>
And this child POM file (hawaii-banner\api\pom.xml):
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>edu.hawaii.sakai</groupId>
<artifactId>hawaii-banner</artifactId>
<version>2.5.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<name>University of Hawaii Banner API</name>
<groupId>edu.hawaii.sakai</groupId>
<artifactId>hawaii-banner-api</artifactId>
<version>${hawaii.banner.version}</version>
<packaging>jar</packaging>
<properties>
<deploy.target>shared</deploy.target>
</properties>
<dependencies>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</dependency>
<dependency>
<groupId>edu.gatech.sakai</groupId>
<artifactId>uh-gatech-banner-api</artifactId>
<version>${uh-gatech.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
But I'm getting this error:
[ERROR] 'dependencies.dependency.version' for edu.gatech.sakai:uh-gatech-banner-api:jar must be a valid version but is '${uh-gatech.version}'. # edu.hawaii.sakai:hawaii-banner-api:${hawaii.banner.version}, C:\hawaii-sakai-2.9.3\sakai-src-2.9.3\hawaii-banner\api\pom.xml, line 26, column 16
I don't understand why I'm getting this error because uh-gatech.version is defined in the parent POM file, and <version>${uh-gatech.version}</version> used to be <version>2.5.1</version>, which worked.
I ran mvn clean install from the same directory as the parent POM file, and it didn't work.

If maven gives this error, it means that the child module does not recognize the parent properly. I've seen this happen with wrong versions.
You think you are defining the right parent, but you are not. As #jordan suggested, by eliminating the child-parent relationship, you can see it works.
You cannot define the version of a module to be a variable you defined in the same pom, and maven will not want on this.
Although you think it's 2.5.0, it's not...
I suggest you review this relationship definition in your project.
I hope this helps.

Related

Groovy-Eclipse Compilation Failed : Source level should be in '1.1'...'1.8','9'...'15' (or '5.0'..'15.0'): 17

I wanted to compile groovy along with java sources so I added groovy-eclipse-compiler to pom.xml but I got an error:
Groovy-Eclipse: source level should be in '1.1'...'1.8','9'...'15' (or '5.0'..'15.0'): 17
pom.xml as follows:
<?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.app</groupId>
<artifactId>mb2g-alt-jvm</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<classifier>indy</classifier>
<version>3.0.10</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version><!-- 3.6.2 is the minimum -->
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<compilerArguments>
<indy/><!-- optional; supported by batch 2.4.12-04+ -->
<configScript>config.groovy</configScript><!-- optional; supported by batch 2.4.13-02+ -->
</compilerArguments>
<failOnWarning>true</failOnWarning><!-- optional; supported by batch 2.5.8-02+ -->
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>3.7.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>3.0.10-02</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>groovy-plugins-release</id>
<url>https://groovy.jfrog.io/artifactory/plugins-release</url>
</pluginRepository>
</pluginRepositories>
</project>
Intellij Java Compiler Version: Java 17
Module Language Level: Java 17
Error Screenshot :
How can I solve it?
Thank you.
Groovy 3 does not suitably support Java 16+ and so groovy-eclipse-batch is currently capped at Java 15. You can set release (aka java.version in you pom) to 15 as indicated in the error message.
Or you can split Java and Groovy compilation in maven so you can set separate release targets.

How to make Quarkus use local library classes

I'm starting with Quarkus using Maven and can't seem to find a solution to this:
I have a Quarkus app with dependencies on the libraries A and B. Both are imported as "Modules" (not Maven modules!) in the IntelliJ IDEA project for my app.
When starting Quarkus in dev mode, it ignores the classes in target/ of A and B and instead loads them from the Maven repository. Therefore with every change in either A or B, I have to mvn install the respective library, so my Quarkus app uses the correct code.
Coming from Thorntail, this was not necessary. Is there a solution that doesn't require auto-installing A and B on every build and also makes HotSwap work for those libs?
Edit:
As #CrazyCoder requested, here's a minimal example of 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>test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<quarkus-plugin.version>1.8.3.Final</quarkus-plugin.version>
<quarkus.platform.version>1.8.3.Final</quarkus.platform.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-universe-bom</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>A</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>B</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
A and B are listed in IntelliJ IDEA under "Project Structure... > Modules > test > Dependencies" as Module Depenencies, not Maven Dependencies. So the code in A and B should be HotSwappable.
I eventually found the solution. As so often: Once you know it, it's trivial.
Open your run configuration, expand the Environment dropdown (only populated when an application module is selected) and check the option Resolve Workspace artifacts:

No schemas have been found - Spring Boot WS

I have the next throuble:
When I follow the Spring boot WS example with maven, when I follow the steps, after add the xsd file, the guide indicate how to add the plugin to pom.xml file and this automatically turn the xsd file into java class objects. But I've received this:
No schemas have been found (org.codehaus.mojo:jaxb2-maven-plugin:1.6:xjc:xjc:generate-sources)
org.apache.maven.plugin.MojoExecutionException: No schemas have been found
at org.codehaus.mojo.jaxb2.AbstractXjcMojo.execute(AbstractXjcMojo.java:376)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331)
at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362)
...
Here 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.tester</groupId>
<artifactId>test-ws</artifactId>
<version>0.0.1</version>
<packaging>war</packaging>
<name>test-ws</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
</dependency>
</dependencies>
<properties>
<java.version>1.7</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaDirectory>${project.basedir}/src/main/resources/</schemaDirectory>
<outputDirectory>${project.basedir}/src/main/java</outputDirectory>
<clearOutputDir>false</clearOutputDir>
</configuration>
</plugin>
</plugins>
</build>
This is a screenshot how is look like the error:
Any help is appreciated!
Ok, if someone has the same error, I got the solution like this:
First, I configured the maven user settings in eclipse by adding a separate repository folder for the related project (Override the default path located in X:\Users\User.m2\repository).
I removed two custom profiles that I had in the previous file.
I updated the project and magically, the error disappeared.
Thanks to all for the help.

How to config Flex Mojos Unit test by maven

Like java I would like to perform unit test in maven flex mojo. but unable to perform unit test. Here is the pom file for your observation.
<?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.formativesoft.flex</groupId>
<artifactId>rdpair</artifactId>
<version>1.0.1</version>
<packaging>swf</packaging>
<name>rdpair Flex</name>
<dependencies>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>flex-framework</artifactId>
<version>4.5.1.21328</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.adobe.flexunit</groupId>
<artifactId>flexunit</artifactId>
<version>0.85</version>
<type>swc</type>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/flex</sourceDirectory>
<testSourceDirectory>src/test/flex</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>4.0-RC2</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
which properties/plugins/dependency is missing for performing maven unit test?
You should declare which files contains the tests:
<includeTestFiles>
<includeTestFile>*Test.as</includeTestFile>
</includeTestFiles>
And also specify the path to the flash player (move that in your settings.xml)
<properties>
<flex.flashplayer.url>C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.6\player\win\11.1\FlashPlayerDebugger.exe</flex.flashplayer.url>
</properties>

Maven ear problem

I'm finishing my project build (with maven), and it's working great. Now I just have to "pack it", as an ear.
All I need to do is pack 3 dependencies, one .jar and 2 .war. Don't ask me how, that was the way it was done before (with ant), and I'm translating it to maven - next I'll organize the packages, so we can be more productive.
However, I'm having a few problems. First, the package is named null-${version}.ear. It copies itself right to the repository, but in the target folder is wrongly named. And second, it's copying all the other packages dependencies. I want to know what can I do about the null name, and the copying of the packages.
Here is my pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>owner</groupId>
<artifactId>coreisp</artifactId>
<version>2.0</version>
</parent>
<groupId>owner</groupId>
<artifactId>coreisp-app</artifactId>
<packaging>ear</packaging>
<version>2.0</version>
<name>Projeto CoreISP</name>
<dependencies>
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>coreisp-core</artifactId>
<version>${pom.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>coreisp-initializer</artifactId>
<type>war</type>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>coreisp-site</artifactId>
<type>war</type>
<version>${pom.version}</version>
</dependency>
</dependencies>
<build>
<finalName>${application.id}-${pom.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.3</version>
<configuration>
<modules>
<jarModule>
<groupId>owner</groupId>
<artifactId>coreisp-core</artifactId>
<includeInApplicationXml>
true
</includeInApplicationXml>
<bundleDir>/</bundleDir>
</jarModule>
<webModule>
<groupId>owner</groupId>
<artifactId>
coreisp-initializer
</artifactId>
<bundleDir>/</bundleDir>
</webModule>
<webModule>
<groupId>owner</groupId>
<artifactId>
coreisp-site
</artifactId>
<bundleDir>/</bundleDir>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
</project>
First of all remove the element from your POM, the application.id property is what gives you the "null" name.
As to ensure that transitive dependencies do not end up in your EAR I suggest you specify explicitly in your POM what you do want and what you do not want. In order to keep a dependency out all you need to do is define it in your POM with a scope of provided. I know it's a painful job, but in my opinion it's worth it, to ensure that you get exactly what you want.

Resources