maven error : package io.kubernetes.client.apis does not exist - java

I am new to maven and junit. I have tried to build a maven project through which I want to try the kubernetes official java client api examples. While compiling the pom.xml file encountered an error. I am trying to run the maven project using command line. In order to compile the pom.xml file I have used "mvn clean package install"
<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>ocp</groupId>
<artifactId>DemoTest</artifactId>
<version>14.0.1</version>
<packaging>jar</packaging>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven-plugin-version>1.0.0</maven-plugin-version>
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<prerequisites>
<maven>2.2.0</maven>
</prerequisites>
<dependencies>
<dependency>
<groupId>io.kubernetes</groupId>
<artifactId>client-java-api</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.kubernetes</groupId>
<artifactId>client-java</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.kubernetes</groupId>
<artifactId>client-java-proto</artifactId>
<version>14.0.0</version>
<scope>compile</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
</plugins>
</build>
</project>
Error:-
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /mnt/d/junit/test/new/DemoTest/src/main/java/ocp/App.java:[3,28] package io.kubernetes.client does not exist
[ERROR] /mnt/d/junit/test/new/DemoTest/src/main/java/ocp/App.java:[4,28] package io.kubernetes.client does not exist
[ERROR] /mnt/d/junit/test/new/DemoTest/src/main/java/ocp/App.java:[5,28] package io.kubernetes.client does not exist
[ERROR] /mnt/d/junit/test/new/DemoTest/src/main/java/ocp/App.java:[6,33] package io.kubernetes.client.apis does not exist
[ERROR] /mnt/d/junit/test/new/DemoTest/src/main/java/ocp/App.java:[7,35] package io.kubernetes.client.models does not exist
[ERROR] /mnt/d/junit/test/new/DemoTest/src/main/java/ocp/App.java:[8,35] package io.kubernetes.client.models does not exist
[ERROR] /mnt/d/junit/test/new/DemoTest/src/main/java/ocp/App.java:[9,33] package io.kubernetes.client.util does not exist
[ERROR] /mnt/d/junit/test/new/DemoTest/src/main/java/ocp/App.java:[14,64] cannot find symbol
symbol: class ApiException
location: class ocp.App
[ERROR] /mnt/d/junit/test/new/DemoTest/src/main/java/ocp/App.java:[15,9] cannot find symbol
symbol: class ApiClient
location: class ocp.App
[ERROR] /mnt/d/junit/test/new/DemoTest/src/main/java/ocp/App.java:[15,28] cannot find symbol
symbol: variable Config
location: class ocp.App
Please suggest what have I missed.

You don't need dependency of type "pom" - just remove this line and try to rebuild.
Maven will try to "bring" the dependency (by downloading it from the centralized repo) to your classpath. In java dependencies like this are jars.
So that's the problem I believe
Also, compile is a default scope anyway, so you can omit it.
In addition, project.version points on the version of your product, probably you want a specific version of the dependency, like 14.0.1 (the last version available in maven central)
It might be a coincidence, but your own project also has the same version (14.0.1) exactly. I don't see a reason to do so, you can start your project with your own version that has nothing to do with k8s java client's version)
For example you can use 1.0-SNAPSHOT
An example of the dependency definition (of k8s java client as you've stated in the question title) is:
<dependency>
<groupId>io.kubernetes</groupId>
<artifactId>client-java-api</artifactId>
<version>14.0.1</version>
</dependency>
The rest of the dependencies in the presented pom also should be fixed in a similar way.

Related

Cannot create custom BOM. Project build fails with Non-resolvable import POM: Could not find artifact

I am using eclipse mars with embedded maven (version 3.3.9) and i am facing a problem i cannot understand in order to resolve it. I have been trying to create a JMS related "library" that some other projects can use in their pom under their dependencyManagement section (in other words following the "BOM" pattern). However, when the created BOM is pulled in the dependencyManagement section of the corresponding project that is supposed to use it, the dependencies specified are pulled in, but the project build itself (mvn clean install) fails with an error shown further down.
The structure i used is the following:
A "jms-dependencies-BOM" project (packaged as pom), which includes as a submodule a "jms-dependencies-parent" project (again packaged as pom) which in turn inherits from the "jms-dependencies-BOM" project. Additionally, there is a "amqdeps" submodule of the aforementioned "jms-dependencies-parent" project (packaged as a jar). The "amqdeps" submodule also inherits from the "jms-dependencies-parent" project. The corresponding project that is supposed to import the "jms-dependencies-BOM" pom in its dependencyManagement section and use the "amqdeps" dependency in the dependencies section is "TestIntegrator".
Although it does sound like a duplicate i am not sure it is. My error message is a bit different (no mention of an incorrect relative path for example as in other questions).Now i have tried everything i could think of, purging the whole .m2/repository folder, tried to build the TestIntegrator project from the cli using even a slightly different maven version (3.2) than the embedded one in eclipse. Basically i have tried everything suggested by similar questions asked,all to the same result. I suppose it is something with the way i have structured the BOM hierarchy of the projects (the relative paths perhaps, although the compiler does not complain about it) but i do not understand it enough.
"jms-dependencies-BOM" 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>jms-dependencies-BOM</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<amqdeps.version>0.0.1-SNAPSHOT</amqdeps.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>amqdeps</artifactId>
<version>${amqdeps.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<module>jms-dependencies-parent</module>
</modules>
</project>
The "jms-dependencies-parent" 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.test</groupId>
<artifactId>jms-dependencies-BOM</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<groupId>com.test</groupId>
<artifactId>jms-dependencies-parent</artifactId>
<packaging>pom</packaging>
<properties>
<activemq.version>5.13.1</activemq.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId>
<version>${activemq.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-openwire-legacy</artifactId>
<version>${activemq.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-camel</artifactId>
<version>${activemq.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-jaas</artifactId>
<version>${activemq.version}</version>
</dependency>
<--MORE DEPENDENCIES TRUNCATED FOR CLARITY-->
</dependencies>
</dependencyManagement>
<modules>
<module>amqdeps</module>
</modules>
</project>
The "amqdeps" 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.test</groupId>
<artifactId>jms-dependencies-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>amqdeps</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-openwire-legacy</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-camel</artifactId>
</dependency>
<--MORE DEPENDENCIES TRUNCATED FOR CLARITY-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
</plugins>
</build>
</project>
and finally the "TestIntegrator" 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>TestIntegrator</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<spring.framework.version>5.1.4.RELEASE</spring.framework.version>
<jms-dependencies-BOM.version>0.0.1.SNAPSHOT</jms-dependencies-BOM.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring.framework.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.test</groupId>
<artifactId>jms-dependencies-BOM</artifactId>
<version>${jms-dependencies-BOM.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
</dependency>
<dependency>
<groupId>com.test</groupId>
<artifactId>amqdeps</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
</plugins>
</build>
</project>
When i do a mvn clean install in the parent project (i.e. "jms-dependencies-BOM") everything is build and i can see the corresponding poms for the "jms-dependencies-BOM",
"jms-dependencies-parent" and "amqdeps" (and the jar for the amqdeps project as well) being installed in the corresponding .m2/repository folder under directories of com/test/... . In addition i can see the dependencies listed in the amqdeps project being pulled in the TestIntegrator project, with no errors showing anywhere. However, every time i try to perform a mvn clean install from the IDE in the TestIntegrator project it fails with the following error:
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Could not find artifact com.test:jms-dependencies-BOM:pom:0.0.1.SNAPSHOT # line 43, column 16
[ERROR] 'dependencies.dependency.version' for com.test:amqdeps:jar is missing. # line 104, column 14
#
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.test:IgniteIntegrator:0.0.1-SNAPSHOT (C:\Users\matrix\eclipse-mars\workspace\TestIntegrator\pom.xml) has 2 errors
[ERROR] Non-resolvable import POM: Could not find artifact com.test:jms-dependencies-BOM:pom:0.0.1.SNAPSHOT # line 43, column 16 -> [Help 2]
[ERROR] 'dependencies.dependency.version' for com.test:amqdeps:jar is missing. # line 104, column 14
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
Can anyone help me out please?
The reason for this particular error seems to be a simple typo in the version string. Your are trying to import
<jms-dependencies-BOM.version>0.0.1.SNAPSHOT</jms-dependencies-BOM.version>
while the project version is actually
<version>0.0.1-SNAPSHOT</version>
Note the . vs - difference.
That said, I do believe you should read more about Project Inheritance vs Project Aggregation and make sure you understand the details of how reactor builds work. Then perhaps you may want to re-think how you structure your modules. I'm not judging you (may be you have your good reasons to do what you do), but at first look it seams your multi-module structure is somewhat messy and thus fragile.

Java 11 without modularity: package does not exist while it is added as maven dependency

I have three very simple applilcations. One is COMMON which I will center security configs, other with ZUUL feature and the third is a EUREKA SERVER. Both are Spring Boot and Java 11. Although I am using Java 11 I am not reling on modularity (as far as I know it will not make sense use modularity feature with Spring Boot).
When I run all three in Eclipse I successfully can run the server, common and zuul in that sequence. When I try to maven build I get the error mentioned in subject.
The immediate explanation would be "you don't have common in zuul classpath". Well, as far as I check I do have common in zuul classpath. I am wondering if there is any extra config because I am using Java 11 but not using modularaty.
By saying I am using Java 11 but not modularity I mean, I have Java 11 but I don't have module-info.java at all in any of the three projects.
Checking in .m2 folder and unzip the common.jar I do see the class complained.
Zuul project pom:
<?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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.test</groupId>
<artifactId>zuul</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>zuul</name>
<description>Zuul project</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>Greenwich.SR1</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>com.test</groupId>
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Evidence that common is the maven dependences
Error during mvn clean install:
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------------< com.test:zuul >----------------------------
[INFO] Building zuul 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # zuul ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) # zuul ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to C:\_d\WSs\soteste\zuul\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[14,32] package com.test.common.security does not exist
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[21,17] cannot find symbol
symbol: class JwtConfig
location: class com.test.zuul.security.SecurityTokenConfig
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[46,16] cannot find symbol
symbol: class JwtConfig
location: class com.test.zuul.security.SecurityTokenConfig
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[47,23] cannot find symbol
symbol: class JwtConfig
location: class com.test.zuul.security.SecurityTokenConfig
[INFO] 4 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.778 s
[INFO] Finished at: 2019-03-21T14:23:23-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project zuul: Compilation failure: Compilation failure:
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[14,32] package com.test.common.security does not exist
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[21,17] cannot find symbol
[ERROR] symbol: class JwtConfig
[ERROR] location: class com.test.zuul.security.SecurityTokenConfig
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[46,16] cannot find symbol
[ERROR] symbol: class JwtConfig
[ERROR] location: class com.test.zuul.security.SecurityTokenConfig
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[47,23] cannot find symbol
[ERROR] symbol: class JwtConfig
[ERROR] location: class com.test.zuul.security.SecurityTokenConfig
[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
The class complained is in the jar
*** Edited
Common pom
<?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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.test</groupId>
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>common</name>
<description>Zuul project</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>Greenwich.SR1</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</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>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
That's because the common project is a Spring Boot Application (I see the BOOT-INF folder inside the generated jar).
From Use a Spring Boot Application as a Dependency documentation:
The executable archive cannot be used as a dependency as the
executable jar format packages application classes in BOOT-INF/classes.
This means that they cannot be found when the executable jar is used
as a dependency.
To produce the two artifacts, one that can be used as a dependency and
one that is executable, a classifier must be specified. This
classifier is applied to the name of the executable archive, leaving
the default archive for use as a dependency.
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin>
</plugins>
</build>
Here is an example:
The first jar is build as dependency-able, the second one is Spring Boot executable.
That Eclipse is able to resolve Eclipse projects of the currently open workspace as Maven dependencies into other projects is a specialty of Eclipse.
If you execute Maven on command-line or from within Eclipse you leave the sphere of Eclipse and use plain Maven. Plain Maven (even the in Eclipse integrated Maven) does not know about Eclipse projects, it only knows the artifacts available in your local and the configured remote repositories.
Therefore the correct approach in your case is to first execute mvn install on your common project. This installs common into your local repo and makes it available to Maven.
Afterwards you can execute mvn clean install on your zuul project.

Error when deploying maven project to Google app engine

I was trying to deploy a maven project to Google App Engine, but whenever i use the command mvn appengine:deploy in cmd i get this error
[INFO] GCLOUD:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 08:43 min
[INFO] Finished at: 2017-04-21T21:43:13+07:00
[INFO] Final Memory: 22M/287M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-
plugin:1.2.1:deploy (default-cli) on project cc_w10: Execution default-cli
of goal com.google.cloud.tools:appengine-maven-plugin:1.2.1:deploy failed:
Non zero exit: 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/PluginExecutionException
Here's 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.cc_w10.sample</groupId>
<artifactId>cc_w10</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
<INSTANCE_CONNECTION_NAME></INSTANCE_CONNECTION_NAME>
<user>user1</user>
<password>1234</password>
<database>sqldemo</database>
<sqlURL>jdbc:mysql://google/sqldemo?cloudSqlInstance=cc-week-five:us-central1:root&socketFactory=com.google.cloud.sql.mysql.SocketFactory&user=root&password=1234&useSSL=false</sqlURL>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>mysql-socket-factory-connector-j-6</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.5</version>
</dependency>
</dependencies>
<build>
<finalName>cc_w10</finalName>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.2.1</version>
</plugin>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.50</version>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.7.v20160115</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Does anyone know how to solve this problem? I've been looking for the solution for days but it seems hopeless.
your project is a spring boot project so try using spring-maven plugin to generate the jar
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
I had the same problem, and tried it a different way.
Since appengine:deploy didn't seem to copy my app.yaml but instead created its own, I tried to use gcloud commands directly on the target/appengine-staging after pasting my yaml file.
Then I run gcloud app deploy and it worked thanks to this line I added in app.yaml:
health_check: enable_health_check: False
Starting from version 1.3.0 the appengine plugin even doesn't detect my app.yaml in the first place. However it's set on the root folder. I suppose it requires it in a different place/folder but I don't know which one.
Pretty late to the party, but make sure you have specified the packaging as 'war'. That solved my issue.

Error When Compiling Maven Selenium Project - Compilation Error packages not found

I tried to run maven project of Selenium testing (maven -install)
Below is the 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>deprecated</groupId>
<artifactId>deprecated</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.46.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.46.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<forkMode>never</forkMode>
<suiteXmlFiles>
<suiteXmlFile>testsuite/TestSuiteBukalapak.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
Compilation error complaining package org.openqa.selenium does not exist, package org.testng does not exist, package org.testng.annotations does not exist and others as if the maven build is missing something.
[INFO] Compiling 43 source files to D:\deprecated\selenium_testng\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/Tambah_Alamat.java:[3,27] package org.openqa.selenium does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/Tambah_Alamat.java:[4,27] package org.openqa.selenium does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/Tambah_Alamat.java:[5,35] package org.openqa.selenium.support does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/Tambah_Alamat.java:[6,18] package org.testng does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/Tambah_Alamat.java:[7,30] package org.testng.annotations does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[5,27] package org.openqa.selenium does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[6,34] package org.openqa.selenium.chrome does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[7,34] package org.openqa.selenium.chrome does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[8,34] package org.openqa.selenium.chrome does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[9,35] package org.openqa.selenium.firefox does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[10,35] package org.openqa.selenium.firefox does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[11,42] package org.openqa.selenium.support.events does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[12,18] package org.testng does not exist
Can you please help give me a clue, any specific dependency I need to insert on the pom ? Thanks
try adding
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>${selenium.version}</version>
</dependency>
You can add below depdency and give it a try:
<dependency>
<groupId>org.openqa.selenium.server</groupId>
<artifactId>selenium-server-coreless</artifactId>
<version>1.0-20081010.060147</version>
</dependency>
More detail here
I met the issue today just the same as you.
Here is the way I fix it:
I downloaded "geckodriver V0.10.0" here: https://github.com/mozilla/geckodriver/releases, I use mac, so the file I choose is: geckodriver-v0.10.0-macos.tar.gz
I also update the selenium-server version to 3.0.0-beta2 from here: http://www.seleniumhq.org/download/ => [Download version 3.0.0-beta2]
Last, I set the required property for using "geckodriver" in code before new FirefoxDriver:
System.setProperty("webdriver.gecko.driver","/xxx/yyy/geckodriver");
Then it worked, hope it will be helpful for you.
To the end I found the imported package has changed from "org.openqa.selenium.server.SeleniumServer;
" to "org.openqa.selenium.remote.server.SeleniumServer"
*For other reference: http://learn-automation.com/use-firefox-selenium-using-geckodriver-selenium-3/
Trying to Replace Selenium Dependancy
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>

maven jboss-as:start A required class was missing ... org/sonaty.../ArtifactResolutionException

I am attempting to start a jboss-as server using the mvn jboss-as:start command and simply put it won't run.
http://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final:start (default-cli) on project thenaglecode: Execution default-cli of goal org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final:start failed: A required class was missing while executing org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final:start: org/sonatype/aether/resolution/ArtifactResolutionException
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/jxnagl/.m2/repository/org/jboss/as/plugins/jboss-as-maven-plugin/7.4.Final/jboss-as-maven-plugin-7.4.Final.jar
[ERROR] urls[1] = file:/C:/Users/jxnagl/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
...
[ERROR] urls[33] = file:/C:/Users/jxnagl/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.2/maven-plugin-annotations-3.2.jar
[ERROR] urls[34] = file:/C:/Users/jxnagl/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.10/plexus-utils-3.0.10.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: org.sonatype.aether.resolution.ArtifactResolutionException
[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]
This link: '[Help 1]' from the above error log at the bottom of the trace shows that this issue is very new, not more than a day old.
the page however is not very useful to me, maybe because i am new to maven so please be nice to me, i.e. i can't figure out what dependency is failing.
Here is my pom.xml for your perusal, forgive the overkill on properties, i'm going to revert this way of doing things soon.
<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.thenaglecode</groupId>
<artifactId>thenaglecode</artifactId>
<packaging>pom</packaging>
<version>1.0.0.Pre-Alpha</version>
<modules>
<module>core</module>
<module>algorithms</module>
<module>web</module>
<module>testing</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- the nagle code properties -->
<thenaglecode.java.compiler.version>1.7</thenaglecode.java.compiler.version>
<thenaglecode.java.home>C:\Program Files\Java\jdk1.7.0_25</thenaglecode.java.home>
<thenaglecode.version>1.0.0.Pre-Alpha</thenaglecode.version>
<!-- third party library versions format: "libraries.version.<groupid>.<artifactid>" -->
<libraries.version.org.jboss.spec.jboss-javaee-6.0>3.0.2.Final
</libraries.version.org.jboss.spec.jboss-javaee-6.0>
<libraries.version.org.jboss.spec.jboss-javaee-all-6.0>3.0.2.Final
</libraries.version.org.jboss.spec.jboss-javaee-all-6.0>
<libraries.version.org.jboss.as.jboss-as-arquillian-container-remote>7.2.0.Final
</libraries.version.org.jboss.as.jboss-as-arquillian-container-remote>
<libraries.version.org.jboss.arqullian.protocol.arquillian-protocol-servlet>1.1.0.Final
</libraries.version.org.jboss.arqullian.protocol.arquillian-protocol-servlet>
<libraries.version.org.jboss.weld.weld-api>2.0.Final</libraries.version.org.jboss.weld.weld-api>
<libraries.version.org.jboss.arquillian.container.arquillian-glassfish-remote-3.1>1.0.0.CR4
</libraries.version.org.jboss.arquillian.container.arquillian-glassfish-remote-3.1>
<libraries.version.org.jboss.spec.javax.servlet.jstl.jboss-jstl-api_1.2_spec>1.0.3.Final
</libraries.version.org.jboss.spec.javax.servlet.jstl.jboss-jstl-api_1.2_spec>
<libraries.version.org.jboss.arquillian.arquillian-bom>1.1.1.Final
</libraries.version.org.jboss.arquillian.arquillian-bom>
<libraries.version.xalan.xalan>2.7.1</libraries.version.xalan.xalan>
<libraries.version.joda-time.joda-time>2.2</libraries.version.joda-time.joda-time>
<libraries.version.junit.junit>4.11</libraries.version.junit.junit>
<libraries.version.org.apache.commons.commons-lang3>3.1</libraries.version.org.apache.commons.commons-lang3>
<libraries.version.commons-collections.commons-collections>3.2.1</libraries.version.commons-collections.commons-collections>
<libraries.version.commons-io.commons-io>2.4</libraries.version.commons-io.commons-io>
<!-- plugins format: "plugins.version.<groupid>.<artifactid>" -->
<plugins.version.org.jboss.as.plugins.jboss-as-maven-plugin>7.4.Final</plugins.version.org.jboss.as.plugins.jboss-as-maven-plugin>
<plugins.version.org.apache.maven.plugins.maven-compiler-plugin>3.1</plugins.version.org.apache.maven.plugins.maven-compiler-plugin>
<plugins.version.org.jboss.as.plugins.jboss-as-maven-plugin>7.4.Final</plugins.version.org.jboss.as.plugins.jboss-as-maven-plugin>
</properties>
<dependencyManagement>
<dependencies>
<!-- thenaglecode projects -->
<dependency>
<groupId>com.thenaglecode</groupId>
<artifactId>core</artifactId>
<version>${thenaglecode.version}</version>
</dependency>
<dependency>
<groupId>com.thenaglecode</groupId>
<artifactId>web</artifactId>
<version>${thenaglecode.version}</version>
</dependency>
<dependency>
<groupId>com.thenaglecode</groupId>
<artifactId>algorithms</artifactId>
<version>${thenaglecode.version}</version>
</dependency>
<!-- third party libraries -->
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${libraries.version.org.jboss.arquillian.arquillian-bom}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-all-6.0</artifactId>
<version>${libraries.version.org.jboss.spec.jboss-javaee-all-6.0}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${libraries.version.org.apache.commons.commons-lang3}</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>${libraries.version.commons-collections.commons-collections}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${libraries.version.commons-io.commons-io}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${libraries.version.junit.junit}</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.servlet.jstl</groupId>
<artifactId>jboss-jstl-api_1.2_spec</artifactId>
<version>${libraries.version.org.jboss.spec.javax.servlet.jstl.jboss-jstl-api_1.2_spec}</version>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>${libraries.version.xalan.xalan}</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${libraries.version.joda-time.joda-time}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>${plugins.version.org.jboss.as.plugins.jboss-as-maven-plugin}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${plugins.version.org.apache.maven.plugins.maven-compiler-plugin}</version>
<configuration>
<source>${thenaglecode.java.compiler.version}</source>
<target>${thenaglecode.java.compiler.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>${plugins.version.org.jboss.as.plugins.jboss-as-maven-plugin}</version>
<configuration>
<javaHome>${thenaglecode.java.home}</javaHome>
<execute-commands/>
<executeCommands/>
</configuration>
</plugin>
</plugins>
</build>
</project>
With Maven 3.1 they switched to using eclipse aether. The jboss-as-maven-plugin uses Sonatype aether as that us what Maven 3.0.x uses. The two versions are not compatible meaning it would require two different plugins would be required. One for Maven 3.1 and one for Maven 3.0.x.
One note is, as you've seen, this only affects the run and start goals. There is no workaround for it. You have to use Maven 3.0.x until a release of the jboss-as-maven-plugin is released that will support eclipse aether.
As far as I understand this bug report : jboss-as-maven-plugin have 2 dependencies on incompatible maven plugin (dependency-plugin and enforcer-plugin).
As a workaround, I would try the following : override incompatible dependencies with newer versions known to be compatible (listed here). To do so : change your pom.xml and add the following dependencies for jboss-as-maven-plugin (i.e. NOT your project dependencies)
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>${plugins.version.org.jboss.as.plugins.jboss-as-maven-plugin}</version>
<configuration>
<javaHome>${thenaglecode.java.home}</javaHome>
<execute-commands/>
<executeCommands/>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version> <!--override 2.6-->
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3</version> <!--override 1.2-->
</dependency>
</dependencies>
</plugin>

Categories

Resources