Quarkus application not starting properly - quarkus

I have a quarkus application, when I build the application with below command, for the first time process is starting perfectly fine
compile quarkus:dev -DskipTests=true
Logs for successful startup:
Press [h] for more options>
Tests paused
Press [r] to resume testing, [h] for more options>
Press [r] to resume testing, [o] Toggle test output, [h] for more options>
INFO [io.qua.arc.pro.BeanProcessor] (build-78) Found unrecommended usage of private members (use package-private instead) in application beans:
- #Inject field com.scania.siddhiapi.resources.RequestHeaders#password
2022-01-12 13:49:51,372 INFO [io.qua.ama.lam.run.MockEventServer] (build-52) Mock Lambda Event Server Started
__ ____ __ _____ ___ __ ____ ______
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2022-01-12 13:49:51,611 WARN [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.http.port" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2022-01-12 13:49:52,206 INFO [io.quarkus] (Quarkus Main Thread) siddhiapi_quarkus 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.6.1.Final) started in 3.979s.
But when I stop and start the process again, process isn't starting...
Logs for unsuccessful startup:
[INFO] Nothing to compile - all classes are up to date
[ERROR] Port 5005 in use, not starting in debug mode
Press [h] for more options>
Tests paused
Press [r] to resume testing, [h] for more options>
Press [r] to resume testing, [o] Toggle test output, [h] for more options>
2022-01-12 18:11:41,354 INFO [io.qua.arc.pro.BeanProcessor] (build-78) Found unrecommended usage of private members (use package-private instead) in application beans:
- #Inject field com.scania.siddhiapi.resources.RequestHeaders#password
When I try to resatrt the machine, and then start the quarkus service it works again.
pom.xml:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.scania.siddhiapi</groupId>
<artifactId>siddhiapi_quarkus</artifactId>
<version>1.0.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>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>2.6.1.Final</quarkus.platform.version>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>${quarkus.platform.artifact-id}</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-amazon-lambda</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-spring-di</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.platform.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>generate-code</goal>
<goal>generate-code-tests</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<configuration>
<parameters>${maven.compiler.parameters}</parameters>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemPropertyVariables>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<quarkus.package.type>native</quarkus.package.type>
</properties>
</profile>
</profiles>
</project>
Please let me know if someone has come across similar behaviour and what could be the rootcause for this.

As #geoand said, perhaps you're not finishing properly the first execution.
In te second execution, we can see this message:
[ERROR] Port 5005 in use, not starting in debug mode
This error message indicates that other application is using the 5005 port.
Looks like your first execution didn't stop and perhaps the second execution can't start because is waiting the http port of the first execution to be released. By default is the 8080 port.
After stopping the first execution, you could try to access localhost:8080 to check if your application is still running.

Related

How to deploy a springboot - war - to - Google AppEngine - Java11

I am trying to deploy a war packaged springboot app - Java 11
Created a brand new springboot web application (packaging war) and followed article https://cloud.google.com/appengine/docs/standard/java-gen2/war-packaging
from step1 . i.e. cloning and installing (https://github.com/GoogleCloudPlatform/java-docs-samples)
spring boot parent
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!-- <version>2.7.2</version>-->
<version>2.5.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<packaging>war</packaging>
<properties>
<java.version>11</java.version>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-dependencies</artifactId>
<!-- <version>2.0.3</version>-->
<version>2.0.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Excluding tomcat from web
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
Added
<dependency>
<groupId>com.example.appengine.demo</groupId>
<artifactId>simple-jetty-main</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
and plugins
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.6.6</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<version>1</version>
<projectId>GCLOUD_CONFIG</projectId>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/appengine-staging
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
src/main/appengine/app.yaml
runtime: java11
entrypoint: 'java -cp "*" com.example.appengine.demo.jettymain.Main myapp-0.0.1-SNAPSHOT.war'
instance_class: B2
handlers:
- url: /.*
script: this field is required, but ignored
manual_scaling:
instances: 1
resources:
cpu: 2
memory_gb: 2.3
disk_size_gb: 20
volumes:
- name: ramdisk1
volume_type: tmpfs
size_gb: 0.5
Output :
Sadly this is not what I am expecting.
Another Variation:
I remembered servlet initalizer is not added, so correct it
#SpringBootApplication
public class DashApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.runDashApplication.class, args);
}
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(DashApplication.class);
}
}
Error:
Application thows error in the logs
"java.lang.IllegalArgumentException: Unable to instantiate
org.springframework.boot.env.EnvironmentPostProcessor
[org.springframework.boot.test.web.SpringBootTestRandomPortEnvironmentPostProcessor]
at
org.springframework.boot.util.Instantiator.instantiate(Instantiator.java:131)
at
java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
What is my mistake ?
Please help - How to create a simple Java 11 , springboot , war package, and deploy to appengine
As mentioned in the comments section, adding spring-boot-starter-test as test dependency in pom.xml fixed the issue.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
Posting the answer as community wiki for the benefit of the community that might encounter this use case in the future.

Maven with OpenJDK 11.0.2 and BouncyCastleProvider

Maven builds properly
# mvn archetype:generate -DgroupId=com.help.idea -DartifactId=client -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false
# mvn install:install-file -Dfile=rs2xml.jar -DgroupId=net.proteanit.sql -DartifactId=rs2xml -Dversion=1.0 -Dpackaging=jar
# mvn package
But while running the jar it gives following error
java -jar target/client-1.0-SNAPSHOT.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider
at com.help.idea.authen.ClientMain.main(ClientMain.java:76)
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
I have following 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.help.idea</groupId>
<artifactId>client</artifactId>
<version>1.0-SNAPSHOT</version>
<name>client</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.jgoodies/jgoodies-common -->
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>jgoodies-common</artifactId>
<version>1.8.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.jgoodies/forms -->
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>forms</artifactId>
<version>1.2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.65</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-dbutils/commons-dbutils -->
<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
<version>1.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/xml-apis/xml-apis -->
<dependency>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.help.idea.authen.ClientMain</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Tried many suggestion from google but could not get it right. Thanks in advance.
welcome to StackOverflow. 👋 The error message tells you that your class ClientMain can't access the class BouncyCastleProvider. A likely cause for this is that the Java Virtual Machine (JVM) that you launched doesn't see the JAR that contains that class. Such JARs would have to be mentioned with the --class-path option.
Looking at your launch command, you can see that there's no class path being specified. One way to fix this, is to enumerate all your direct and transitive dependencies with the --class-path option (although that's a lot of work).
On the other hand, it is possible that this project created a so-called fat JAR, which contains all dependencies. That one, you could launch with just such a short command. Have a look into the target folder and see whether there's another JAR that you can use to launch. Probably something with -jar-with-dependencies in its name (don't launch anything with sources or javadoc in their name, that's pointless).
If this doesn't fix your problem, please follow Darren's comment and show us the full pom, so we can see the entire context.
I appreciate all the responses. I need to learn a lot. you may please refine my answer.
I now created a directory "src/main/resources" and put org/bouncycastle/ in there. Now things are working as expected. But things should have worked directly with maven build.

Test class cannot resolve main class when trying to Unit Test groovy using maven on Jenkins

I am having trouble getting my Unit Tests to work in Maven for a Jenkins shared library written in Groovy.
I am new to Maven and relatively new to Jenkins. The situation is the following:
We have a TFVC server hosting our shared library. The shared library is stored this way:
TFVC
- sharedLibrary
- src
- br
- common
- v1
- SomeClass1.groovy
- SomeClass2.groovy
- SomeClass3.groovy
- test
- groovy
- SomeClass1Tests.groovy
- SomeClass2Tests.groovy
- Jenkinsfile
- pom.xml
The structure src-br-common-v1 cannot be changed. I added the test-groovy structure according to information I found online.
The Jenkinsfile contains the Job to test the library in Maven. It's calling
mvn clean gplus:testCompile
My POM looks like this:
<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>my.company</groupId>
<artifactId>sharedLib</artifactId>
<version>1.0</version>
<name>Jenkins Shared Pipeline Library</name>
<repositories>
<repository>
<id>jenkins</id>
<url>http://repo.jenkins-ci.org/releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>maven-plugin</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-core</artifactId>
<version>2.85</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.12</version>
</dependency>
<dependency>
<groupId>com.cloudbees</groupId>
<artifactId>groovy-cps</artifactId>
<version>1.11</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>script-security</artifactId>
<version>1.24</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>pipeline-utility-steps</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-site-renderer</artifactId>
<version>1.9.2</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/br/common/v1</sourceDirectory>
<testSourceDirectory>src/test/groovy</testSourceDirectory>
<resources>
<resource>
<directory>E:\Jenkins\plugins\pipeline-utility-steps\WEB-INF\lib</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>addSources</goal>
<goal>addTestSources</goal>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<sources>
<source>
<directory>${project.basedir}/src/br/common/v1</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</source>
</sources>
<testSources>
<testSource>
<directory>${project.basedir}/src/br/common/v1</directory>
<directory>${project.basedir}/src/test/groovy</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</testSource>
</testSources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
<argLine>${surefireArgLine}</argLine>
<includes>
<include>**/*Test*.*</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Here is a simplified version of a Test class, lets just assume SomeClass1 contains a method returnTrue that does exactly what you think:
package test.groovy;
import br.common.v1.SomeClass1;
public class SomeClass1Tests extends GroovyTestCase
{
public void testReturnTrue() {
def someClass1Object = new SomeClass1();
def expected = true;
def result = someClass1Object.returnTrue();
assertEquals(expected, result);
}
}
I now have the problem that my Test class cannot resolve the class I want to test.
Unable to resolve class br.common.v1.SomeClass1 # line 2, column 1
Originaly I had my test files in another location in TFVC, but that did not work and I read that gmaven-plus is very picky about where to store your test classes.
I hope I provided all information needed in a practical way, please let me know if I missed anything.
Thank you for your help in advance!
The source directories configured for maven are to specific (they point to where the files are). If you want to import br.common.v1 make sure, that the directory hierarchy br/common/v1 is inside the source roots.

Using SoapUI maven plugin with GitLab - dependencies could not be resolved

I've been having some difficulties setting up my SoapUI test in Gitlab pipeline. At first I was successful getting them to run in principle. By now I've added my real tests into the project and got into some problems with JDBC steps. I have both Oracle and Postgres connections in my steps. Can some of you tell me what I'm doing wrong?
At first I was getting connection errors left and right. Then I realized I probably need to add dependencies. I added
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.8</version>
</dependency>
but nothing changed. I also added oracle driver but now I'm getting
[ERROR] Failed to execute goal com.smartbear.soapui:soapui-maven-plugin:5.5.0:test (default) on project dsa-otsusetugi-soapui-tests: Execution default of goal com.smartbear.soapui:soapui-maven-plugin:5.5.0:test failed: Plugin com.smartbear.soapui:soapui-maven-plugin:5.5.0 or one of its dependencies could not be resolved: Failed to collect dependencies at com.smartbear.soapui:soapui-maven-plugin:jar:5.5.0 -> com.oracle:ojdbc8:jar:12.2.0.1.0: Failed to read artifact descriptor for com.oracle:ojdbc8:jar:12.2.0.1.0: Could not transfer artifact com.oracle:ojdbc8:pom:12.2.0.1.0 from/to rmv_repo (http://repo.rmv/nexus/repository/maven-public/): Transfer failed for http://repo.rmv/nexus/repository/maven-public/com/oracle/ojdbc8/12.2.0.1.0/ojdbc8-12.2.0.1.0.pom: Unknown host repo.rmv: Name or service not known -> [Help 1]
What's interesting that I don't get any errors during the download phase..
https://pastebin.com/1HGXytJk
Currently my pom file containing dependencies looks like this:
<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>blaa.blaah</groupId>
<artifactId>blaa-blaah</artifactId>
<version>1.0-SNAPSHOT</version>
<name>BLAAHSoapUITests</name>
<properties>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.version>3.0.0</maven.version>
<soapui.version>5.5.0</soapui.version>
<surefire.version>2.20</surefire.version>
</properties>
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>http://smartbearsoftware.com/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/test.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>${soapui.version}</version>
<configuration>
<soapuiProperties>
<property>
<name>soapui.logroot</name>
<value>${project.basedir}/build-testlog/build-testlog-</value>
</property>
</soapuiProperties>
<projectFile>${project.basedir}/${projectfile}</projectFile>
<projectProperties>
<value>END_POINT=${END_POINT}</value>
<value>USER_ID=${USER_ID}</value>
</projectProperties>
<outputFolder>${project.basedir}/build-testlog</outputFolder>
<printReport>true</printReport>
<junitReport>true</junitReport>
</configuration>
<dependencies>
<dependency>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui</artifactId>
<version>${soapui.version}</version>
<exclusions>
<exclusion>
<groupId>javafx</groupId>
<artifactId>jfxrt</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1.0</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.8</version>
</dependency>
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>forms</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<outputDirectory>${project.basedir}/build/reports/html</outputDirectory>
</reporting>
Am I doing something wrong? Am I using wrong dependencies?
Thanks in advance.
If anyone is facing something similar then my problem, as it turned out, was that Gitlab runner didn't have permission to access the postgres database. It did get the driver, but couldn't connect due to security settings.
Anyhow I still had problems with oracle driver, since it's not publically in smartbear repo. What I did is that I added the driver locally with the help of this tutorial: https://gist.github.com/timmolderez/92bea7cc90201cd3273a07cf21d119eb
So in the end my pom looked something like this:
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>https://rapi.tools.ops.smartbear.io/nexus/content/groups/public/</url>
</pluginRepository>
<pluginRepository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/lib</url>
</pluginRepository>
</pluginRepositories>
and
<dependency>
<groupId>oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>6.0</version>
</dependency>
groupId, artifactId and version (also folder names and jar, pom files, of course) named like the tutorial said.

What is the correct way to make Maven find the parent POM of my project?

I have a Maven project which is a part of a large scale enterprise system. I have not developed this project, but I have developed a small framework, which I am supposed to test, integrated with it. Upon copying, building and installing the project, it compiled, and I was able to launch it. However, after trying to add my framework (parent pom + 3 modules), I may have changed some settings, and now I am having trouble building the project. I have spent a lot of time trying to break down the problem, but all I have been able to do, is produce different errors, that I understand even less of.
I can't seem to find out where I can tell maven where to look for the parent POM. I have tried both the pom.xml, and settings.xml, but I haven't found any good options. I have also tried to change less obvious parameters, like changing localRepository, or adding repositories, but they proved ineffective
Here is my error message, interlaced with my attempts to fix it:
C:\development\my-main\customer-webpart>mvn install -Dmaven.test.skip=true
This is my domain. this includes the master pom of this project, although it is still part of a bigger system, and not the root. I would like to build, install and run this project, to test my framework. My framework is added as a dependency in the pom.xml.
[INFO] Scanning for projects...
Downloading: http://my-server:8080/archiva/repository/my-repository//
org/myportal/client-product/0.0/client-product-0.0.pom
I do not know where this archiva repository is defined. It is not in the pom.xml, or settings.xml. It seems to have an error with the double /, but the client-product-0.0.pom should not be retrieved from here anyway. It is located at C:/mavenLocalRepository/my-main/client-product/0.0/client-product-0.0.pom
Downloading: http://repo1.maven.org/maven2/org/myportal/
client-product/0.0/client-product-0.0.pom
This was also the wrong location to look for the .pom-file... so then the rest of the error is produced:
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: null:customer-webpart:zip:${org.myportal.version}
Reason: Cannot find parent: org.myportal:client-product for project: null:customer-webpart:zip:${org.myportal.version} for project null:customer-webpart:zip:${org.myportal.version}
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Cannot find parent: org.myportal:client-product for project: null:customer-webpart:zip:${org.myportal.version} for project null:customer-webpart:zip:${org.myportal.version}
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:378)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:292)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.project.ProjectBuildingException: Cannot find parent: org.myportal:client-product for
project: null:customer-webpart:zip:${org.myportal.version} for project null:customer-webpart:zip:${org.myportal.version}
at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1370)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:821)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.ja
va:506)
at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:198)
at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:583)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:461)
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:365)
... 11 more
Caused by: org.apache.maven.project.ProjectBuildingException: POM 'org.myportal:client-product' not found in repository: Unable to download the artifact from any repository
org.myportal:client-product:pom:0.0
from the specified remote repositories:
my-repository (http://my-server:8080/archiva/repository/my-repository/),
localRepository2 (C:/mavenLocalRepository/logging-framework/),
localRepository (C:/mavenLocalRepository/my-main/),
central (http://repo1.maven.org/maven2)
for project org.myportal:client-product
at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:6
03)
at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1366)
... 17 more
Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to download the artifact from any repository
org.myportal:client-product:pom:0.0
from the specified remote repositories:
my-repository (http://my-server:8080/archiva/repository/my-repository/),
localRepository2 (C:/mavenLocalRepository/logging-framework/),
localRepository (C:/mavenLocalRepository/my-main/),
central (http://repo1.maven.org/maven2)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:212)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:74)
at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:5
56)
... 18 more
Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to download the artifact from any repository
at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:331)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:200)
... 20 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue Oct 28 11:15:40 CET 2014
[INFO] Final Memory: 4M/61M
[INFO] ------------------------------------------------------------------------
C:\development\my-main\customer-webpart>
Also, this Eclipse-warning is given on my parent-tag of pom.xml for the project:
Project build error: Non-resolvable parent POM: Failure to transfer org.myportal:client-product:pom:0.0 from http://my-server:8080/archiva/repository/my-repository/ was cached in the local repository, resolution will not be reattempted until the update
interval of my-repository has elapsed or updates are forced. Original error: Could not transfer artifact org.myportal:client-product:pom:0.0 from/to my-repository (http://my-server:8080/archiva/repository/my-repository/): Failed to transfer http://my-server:8080/archiva/repository/my-repository/org/myportal/client-product/0.0/client-product-0.0.pom. Error code 307, Temporarily Moved for Domain Name Expansion and 'parent.relativePath' points at wrong local POM
...and I have tried three different approaches to the parent.relativePath. 1. None at all (no tag present), 2. Empty tag (suggested at another post here) 3. tag with full path of the .pom file.
POM.XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.myportal</groupId>
<artifactId>client-product</artifactId>
<version>0.0</version>
<relativePath>C:\mavenLocalRepository\my-main\org\myportal\client-product\0.0\client-product-0.0.pom</relativePath>
</parent>
<artifactId>my-webpart</artifactId>
<version>${org.myportal.version}</version>
<name>my-webpart</name>
<packaging>zip</packaging>
<description>
customer webpart
</description>
<properties>
<maven.test.skip>true</maven.test.skip>
<org.logging.framework.version>0.0.1-SNAPSHOT</org.logging.framework.version>
</properties>
<build>
<sourceDirectory>src/java</sourceDirectory>
<resources>
<resource>
<directory>src/java</directory>
</resource>
</resources>
<testSourceDirectory>src/test</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.maven.plugins</groupId>
<artifactId>unzip-plugin</artifactId>
<version>${org.unzip.plugin.version}</version>
<executions>
<execution>
<id>unpack</id>
<goals>
<goal>unzip</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<resources>
<resource>
<groupId>org.workflow</groupId>
<artifactId>workflow-framework</artifactId>
<version>${org.myportal.version}</version>
<type>jar</type>
<includes>
<include>*.pdpart</include>
</includes>
<target>src/java/generated/common-pdparts</target>
</resource>
<resource>
<groupId>org.myportal</groupId>
<artifactId>myportal-portletframework</artifactId>
<version>${org.myportal.version}</version>
<type>jar</type>
<includes>
<include>*.pdpart</include>
</includes>
<target>src/java/generated/common-pdparts</target>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.maven.plugins</groupId>
<artifactId>descriptorloader-plugin</artifactId>
<version>${org.descriptorloader.plugin.version2}</version>
<executions>
<execution>
<id>vdoclet-java-clean</id>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<source>src/java</source>
<target>src/java</target>
</configuration>
</execution>
<execution>
<id>vdoclet-java</id>
<goals>
<goal>vdoclet</goal>
</goals>
<configuration>
<source>src/java</source>
<target>src/java</target>
<template>portletdescriptor/Control.vm</template>
<report>target/java-conversion.txt</report>
</configuration>
</execution>
<execution>
<id>vdoclet-jsp-clean</id>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<source>src/java</source>
<target>src/webapp</target>
</configuration>
</execution>
<execution>
<id>vdoclet-jsp</id>
<goals>
<goal>vdoclet</goal>
</goals>
<configuration>
<source>src/java</source>
<target>src/webapp</target>
<template>portletdescriptor/JspControl.vm</template>
<report>target/jsp-conversion.txt</report>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.main</groupId>
<artifactId>main-build-dependencies</artifactId>
<version>${org.main.version}</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.maven.plugins</groupId>
<artifactId>zip-plugin</artifactId>
<version>${org.zip.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<fileSets>
<fileSet>
<directory>src/webapp</directory>
</fileSet>
<fileSet>
<directory>target/classes</directory>
<outputDirectory>WEB-INF/classes/</outputDirectory>
</fileSet>
</fileSets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<!-- Clean generated diretory -->
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>src/java</directory>
<includes>
<include>**/generated/**</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.myportal</groupId>
<artifactId>my-client</artifactId>
<version>${org.myportal.version}</version>
</dependency>
<dependency>
<groupId>org.myportal</groupId>
<artifactId>my-portletdomain</artifactId>
<version>${org.myportal.version}</version>
</dependency>
<dependency>
<groupId>org.myportal</groupId>
<artifactId>effect-client</artifactId>
<version>${org.myportal.version}</version>
</dependency>
<dependency>
<groupId>org.myportal</groupId>
<artifactId>mycase-client</artifactId>
<version>${org.myportal.version}</version>
</dependency>
<dependency>
<groupId>org.myportal</groupId>
<artifactId>mycase-portletdomain</artifactId>
<version>${org.myportal.version}</version>
</dependency>
<!-- myportal -->
<dependency>
<groupId>org.myportal</groupId>
<artifactId>mysecondportal-common</artifactId>
<version>${org.myportal.version}</version>
</dependency>
<dependency>
<groupId>org.myportal</groupId>
<artifactId>mysecondportal-webpartcommon</artifactId>
<version>${org.myportal.version}</version>
</dependency>
<dependency>
<groupId>org.myportal</groupId>
<artifactId>host-types</artifactId>
<version>${org.myportal.version}</version>
</dependency>
<dependency>
<groupId>org.workflow</groupId>
<artifactId>workflow-framework</artifactId>
<version>${org.myportal.version}</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${library.commons.fileupload.version}</version>
</dependency>
<!-- external -->
<dependency>
<groupId>faceless</groupId>
<artifactId>bfopdf</artifactId>
<version>0.0</version>
</dependency>
<!-- main -->
<dependency>
<groupId>org.main</groupId>
<artifactId>main-assemble-ear</artifactId>
<type>pom</type>
<version>${org.main.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.myportal</groupId>
<artifactId>my-webdelegate</artifactId>
<version>${org.myportal.version}</version>
</dependency>
<dependency>
<groupId>org.myportal</groupId>
<artifactId>myportal-portletframework</artifactId>
<version>${org.myportal.version}</version>
</dependency>
<dependency>
<groupId>org.myshare</groupId>
<artifactId>myshare-common</artifactId>
<version>${org.myshare.version}</version>
</dependency>
<dependency>
<groupId>org.myshare</groupId>
<artifactId>myshare-webpartcommon</artifactId>
<version>${org.myshare.version}</version>
</dependency>
<dependency>
<groupId>org.docflow</groupId>
<artifactId>docflow-client</artifactId>
<version>${org.myportal.version}</version>
</dependency>
<dependency>
<groupId>org.docflow</groupId>
<artifactId>docflow-webdao</artifactId>
<version>${org.myportal.version}</version>
</dependency>
<dependency>
<groupId>org.esb.logging</groupId>
<artifactId>logging-framework</artifactId>
<version>${org.logging.framework.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>localRepository</id>
<url>C:/mavenLocalRepository/my-main/</url>
</repository>
<repository>
<id>localRepository2</id>
<url>C:/mavenLocalRepository/logging-framework/</url>
</repository>
</repositories>
</project>
parent (client-product-0.0.pom):
<?xml version="1.0" encoding="ISO-8859-1"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.product</groupId>
<artifactId>my-version-pom</artifactId>
<version>0.0</version>
<relativePath>..</relativePath>
</parent>
<groupId>org.product</groupId>
<artifactId>my-product</artifactId>
<packaging>pom</packaging>
<version>0.0</version>
<name>my-product ${project.version} (old root-pom, now child of ${parent.artifactId})</name>
<modules>
<module>my-foundation-pom</module>
<module>pb-product-pom</module>
</modules>
<properties>
<!-- NISX: These properties should never be changed. Only change the value of org.component.version. -->
<org.assemble.my.version>${org.component.version.with.build.number}</org.assemble.my.version>
<org.myportal.version>${org.component.version}</org.myportal.version>
<org.myshare.version>${org.component.version}</org.myshare.version>
... + several others. shortened for stackoverflow
</properties>
<build>
<plugins>
<plugin>
<!-- NISX: This is a trick to avoid the ghost pom to be ever deployed to a repository. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.4</version>
<inherited>false</inherited>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.maven.plugins</groupId>
<artifactId>qdev-maven-plugin</artifactId>
<version>${org.qdev.plugin.version}</version>
<inherited>true</inherited>
<configuration>
<beaDeployDirectory>${qdev.deploy.dir}</beaDeployDirectory>
<earName>${qdev.ear.name}</earName>
<warName>${qdev.war.name}</warName>
<isSingleWar>true</isSingleWar>
</configuration>
</plugin>
<plugin>
<groupId>org.maven.plugins</groupId>
<artifactId>maven-udv-plugin</artifactId>
<version>1.1.2</version>
<configuration>
<settingsApplicationName>my</settingsApplicationName>
<settingsApplicationVersion>${my.branch.name}</settingsApplicationVersion>
<settingsApplicationState>${profile.state}</settingsApplicationState>
</configuration>
</plugin>
</plugins>
</build>
</project>

Resources