I'm getting a failure trying to run a Hello World Mulesoft project, it looks like it related to the version of Mulesoft that I'm running, I googled around but I couldn't get any info to help resolve this issue, here is the build error:
[10:01:21] Running: mvn clean package -DskipMunitTests
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Mule firsttest Application 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.mulesoft.muleesb:mule-core-ee:jar:3.8.4 is missing, no dependency information available
[WARNING] The POM for com.mulesoft.muleesb.modules:mule-module-spring-config-ee:jar:3.8.4 is missing, no dependency information available
[WARNING] The POM for com.mulesoft.muleesb.transports:mule-transport-jdbc-ee:jar:3.8.4 is missing, no dependency information available
[WARNING] The POM for com.mulesoft.muleesb.transports:mule-transport-jms-ee:jar:3.8.4 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.496 s
[INFO] Finished at: 2017-08-31T10:01:27-05:00
[INFO] Final Memory: 8M/245M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "compiler" could not be activated because it does not exist.
[ERROR] Failed to execute goal on project firsttest: Could not resolve dependencies for project com.schwab:firsttest:mule:1.0.0-SNAPSHOT: Failed to collect dependencies at org.mule.transports:mule-transport-file:jar:3.8.4: Failed to read artifact descriptor for org.mule.transports:mule-transport-file:jar:3.8.4: Failure to find org.mule.transports:mule-transports:pom:3.8.4 in http://repo1.maven.org/maven2/ was cached in the local repository, resolution will not be reattempted until the update interval of Central has elapsed or updates are forced -> [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/DependencyResolutionException
Here is the POM file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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.schwab</groupId>
<artifactId>firsttest</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule</packaging>
<name>Mule firsttest Application</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<mule.version>3.8.4</mule.version>
<mule.tools.version>1.2</mule.tools.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-app-maven-plugin</artifactId>
<version>${mule.tools.version}</version>
<extensions>true</extensions>
<configuration>
<copyToAppsDirectory>true</copyToAppsDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-resource</id>
<phase>generate-resources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main/app/</directory>
</resource>
<resource>
<directory>src/main/api/</directory>
</resource>
<resource>
<directory>mappings/</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- Mule Dependencies -->
<dependencies>
<!-- Xml configuration -->
<dependency>
<groupId>com.mulesoft.muleesb</groupId>
<artifactId>mule-core-ee</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- Xml configuration -->
<dependency>
<groupId>com.mulesoft.muleesb.modules</groupId>
<artifactId>mule-module-spring-config-ee</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- Mule Transports -->
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-file</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-http</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.muleesb.transports</groupId>
<artifactId>mule-transport-jdbc-ee</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.muleesb.transports</groupId>
<artifactId>mule-transport-jms-ee</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-vm</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- Mule Modules -->
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-scripting</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-xml</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- for testing -->
<dependency>
<groupId>org.mule.tests</groupId>
<artifactId>mule-tests-functional</artifactId>
<version>${mule.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-http</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-spring-config</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>Central</id>
<name>Central</name>
<url>http://repo1.maven.org/maven2/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>mulesoft-release</id>
<name>mulesoft release repository</name>
<layout>default</layout>
<url>http://repository.mulesoft.org/releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
Any idea of what's going on?
Your help is appreciated.
Maven cannot find transports:mule-transport-file:jar:3.8.4 as it is not available in the Mule Maven repository configured in your pom under <repositories>. This is the Public Mule repository, but it seems the 3.8.4 runtime and its dependencies were not made public, probably only available for Enterprise users. You can see for yourself by browsing the repository, the JAR is missing: https://repository-master.mulesoft.org/nexus/content/repositories/releases/org/mule/transports/mule-transport-file/3.8.4
You can either use Mule 3.8.1 for which your dependency is available (change Mule version in your pom) or configure the Enterprise (EE) repository if you have proper license and access (see https://docs.mulesoft.com/mule-user-guide/v/3.8/configuring-maven-to-work-with-mule-esb)
*Not related note: it seems you are running Mule EE inside Studio. Studio provide EE runtime for testing purposes, so Maven does not complain (too much) about missing EE dependencies, but if you try to run Mule EE outside Studio you will need to configure the EE repository. *
Update Setting.xml with Proxy details,if you are trying from organisation network, it seems it is not able to download all the jars
I am assuming it is your first project. You can disable Maven in order to experience MULE behavior. Right Click on the project and it provides an option to disable Maven. After that you can run your project.
Related
Java 8, maven compile issue on Jenkins
struggling for ages with this one. I can locally build, compile and test everything without a problem. I use same maven command as I use on my Jenkins. I wiped my .m2 folder so I have same empty repo and still everything fine.
This is the maven command I use:
(mvn) -U clean install -PTestExecutor -Dheadless=true -C
this is my 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>
<groupId>com.xxx</groupId>
<artifactId>testing</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<cucumber.version>7.3.3</cucumber.version>
<selenium.version>4.1.4</selenium.version>
<awaitility.version>4.2.0</awaitility.version>
<assertj.version>3.22.0</assertj.version>
<commonsmodel.version>5.3.3</commonsmodel.version>
<maven.compiler.version>3.10.1</maven.compiler.version>
<maven.surefire.version>3.0.0-M6</maven.surefire.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<junit-jupiter-engine.version>5.8.2</junit-jupiter-engine.version>
<maven-cucumber-reporting.version>5.7.0</maven-cucumber-reporting.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit-platform-engine</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite</artifactId>
<version>1.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter-engine.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.jodah</groupId>
<artifactId>failsafe</artifactId>
<version>2.4.4</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>${awaitility.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>${maven-cucumber-reporting.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>TestExecutor</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter-engine.version}</version>
</dependency>
</dependencies>
<configuration>
<includes>
<includes>**/ExecutorTest.java</includes>
</includes>
</configuration>
</plugin>
<!--cucumber report plugin-->
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>${maven-cucumber-reporting.version}</version>
<executions>
<execution>
<id>generate-cucumber-reports</id>
<phase>test</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>Automation report</projectName>
<outputDirectory>${project.build.directory}/cucumber-reports</outputDirectory>
<inputDirectory>${project.build.directory}/cucumber</inputDirectory>
<jsonFiles>
<param>**/*.json</param>
</jsonFiles>
<checkBuildResult>false</checkBuildResult>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
and this is the full error report on Jenkins output:
Executing Maven: -B -f /appl/xxx/jenkins/workspace/Customer_Portal/web-full-suite/pom.xml -s /appl/xxx/maven/apache-maven-3.3.9/conf/settings.xml -U clean install -PTestExecutor -Dheadless=true -C
[INFO] Scanning for projects...
[HUDSON] Collecting dependencies info
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building testing 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: http://nlxxxxcv166.srvfarm4-eur.xxx-group.com:8081/artifactory/Maven_repo/org/apache/maven/maven-core/3.1.0/maven-core-3.1.0.pom
[INFO] Downloading: http://nlxxxxcv166.srvfarm4-eur.xxx-group.com:8081/artifactory/plugins-release/org/apache/maven/maven-core/3.1.0/maven-core-3.1.0.pom
[WARNING] The POM for org.apache.maven:maven-core:jar:3.1.0 is missing, no dependency information available
[INFO] Downloading: http://nlxxxxcv166.srvfarm4-eur.xxx-group.com:8081/artifactory/Maven_repo/org/apache/maven/maven-plugin-api/3.1.0/maven-plugin-api-3.1.0.pom
[INFO] Downloading: http://nlxxxxcv166.srvfarm4-eur.xxx-group.com:8081/artifactory/plugins-release/org/apache/maven/maven-plugin-api/3.1.0/maven-plugin-api-3.1.0.pom
[WARNING] The POM for org.apache.maven:maven-plugin-api:jar:3.1.0 is missing, no dependency information available
[INFO] Downloading: http://nlxxxxcv166.srvfarm4-eur.xxx-group.com:8081/artifactory/plugins-release/io/cucumber/messages/maven-metadata.xml
[INFO] Downloading: http://nlxxxxcv166.srvfarm4-eur.xxx-group.com:8081/artifactory/Maven_repo/io/cucumber/messages/maven-metadata.xml
[INFO] Downloaded: http://nlxxxxcv166.srvfarm4-eur.xxx-group.com:8081/artifactory/Maven_repo/io/cucumber/messages/maven-metadata.xml (421 B at 20.6 KB/sec)
[WARNING] The POM for org.apache.maven:maven-plugin-api:jar:3.8.5 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] Downloading: http://nlxxxxcv166.srvfarm4-eur.xxx-group.com:8081/artifactory/Maven_repo/org/apache/maven/maven/3.1.0/maven-3.1.0.pom
[INFO] Downloading: http://nlxxxxcv166.srvfarm4-eur.xxx-group.com:8081/artifactory/plugins-release/org/apache/maven/maven/3.1.0/maven-3.1.0.pom
[WARNING] Attempt to (de-)serialize anonymous class org.jfrog.hudson.maven2.MavenDependenciesRecorder$1; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.828 s
[INFO] Finished at: 2022-06-13T16:59:43+02:00
[INFO] Final Memory: 18M/152M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal on project testing: Could not resolve dependencies for project com.xxx:testing:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.apache.maven.plugins:maven-surefire-plugin:jar:3.0.0-M6 -> org.apache.maven.surefire:maven-surefire-common:jar:3.0.0-M6 -> org.apache.maven.shared:maven-common-artifact-filters:jar:3.1.1 -> org.apache.maven:maven-artifact:jar:3.1.0: Failed to read artifact descriptor for org.apache.maven:maven-artifact:jar:3.1.0: Could not find artifact org.apache.maven:maven:pom:3.1.0 in XXX-Repo (http://nlxxxxcv166.srvfarm4-eur.xxx-group.com:8081/artifactory/Maven_repo) -> [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/DependencyResolutionException
[JENKINS] Archiving /appl/xxx/jenkins/workspace/Customer_Portal/web-full-suite/pom.xml to com.xxx/testing/1.0-SNAPSHOT/testing-1.0-SNAPSHOT.pom
channel stopped
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at PROJECT level /cucumber/cucumber.html to /appl/xxx/jenkins/jobs/Customer_Portal/jobs/web-full-suite/htmlreports/HTML_20Report
ERROR: Specified HTML directory '/cucumber/cucumber.html' does not exist.
Publishing Selenium report...
Copying the reports.
parsing resultFile cucumber/cucumber.html
Unable to parse cucumber/cucumber.html: java.io.IOException: org.xml.sax.SAXParseException; systemId: file:/appl/xxx/jenkins/jobs/Customer_Portal/jobs/web-full-suite/builds/160/seleniumReports/cucumber/cucumber.html; lineNumber: 1; columnNumber: 10; DOCTYPE is disallowed when the feature "http://apache.org/xml/features/disallow-doctype-decl" set to true.
Set result to FAILURE
Finished: FAILURE
I am working on a java project currently, my problem is a bit weird as yesterday my code was working fine then suddenly today when I try to build and test my code I get this error:
Failed to execute goal on project extraportGlobalSearch: Could not resolve dependencies for project com.api:extraportGlobalSearch:jar:1.0: Failed to collect dependencies for [org.glassfish.jersey.containers:jersey-container-grizzly2-http:jar:2.27 (compile), org.glassfish.jersey.inject:jersey-hk2:jar:2.27 (compile), junit:junit:jar:4.9 (test), com.googlecode.json-simple:json-simple:jar:1.1.1 (compile), com.fasterxml.jackson.core:jackson-annotations:jar:2.5.4 (compile), javax.servlet:javax.servlet-api:jar:3.0.1 (compile), com.google.zxing:core:jar:3.3.3 (compile), com.fasterxml.jackson.core:jackson-databind:jar:2.5.4 (compile), oracle:ojdbc:jar:11.2.0.4 (compile), org.glassfish.grizzly:grizzly-http-server:jar:2.4.0 (compile)]: Failed to read artifact descriptor for oracle:ojdbc:jar:11.2.0.4: Could not transfer artifact oracle:ojdbc:pom:11.2.0.4 from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/oracle/ojdbc/11.2.0.4/ojdbc-11.2.0.4.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
I tried to add another repo using https://repo.maven.apache.org/maven2/ url in my pom.xml but the error still persist. I have tried to resolve this for the past 5 hours, it would be great if anyone can help me, here is my pom.xml:
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.api </groupId>
<artifactId>extraportGlobalSearch</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>extraportGlobalSearch</name>
<repositories>
<repository>
<id>apache2-https</id>
<name>Apache 2 https</name>
<url>https://repo.maven.apache.org/maven2/</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
</dependency>
<!-- uncomment this to get JSON support:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-binding</artifactId>
</dependency>-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.5.4</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.3.3</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.4</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>11.2.0.4</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-http-server</artifactId>
<version>2.4.0</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<!-- Run shade goal on package phase -->
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<!-- add Main-Class to manifest file -->
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.api.GlobalSearch.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<jersey.version>2.27</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Help needed. Thanks in advance.
<packaging>jar</packaging>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
The issue is related to maven moving to https only: https://blog.sonatype.com/central-repository-moving-to-https
I have found that my problem was that Netbeans (8.2) was set to use the bundled maven executable (3.0.5). This version of maven is outdated and does not automatically reach for the https repo.
I have a newer version installed (Apache Maven 3.5.4 (Red Hat 3.5.4-5)
) that worked by executing mvn clean install in my project's directory.
To get Netbeans to use a different version of maven you can go to Tools->Options->Java->Maven and in Maven Home point to where your maven installation is located. For me it was /usr/bin/mvn and I had to define the path as just /usr as it seems that Netbeans expects to find a directory named bin containing the mvn executable.
Also, related to maven moving repositories, for certain old dependencies I had to use the now insecure endpoint in my maven config:
<pluginRepository>
<id>Codehaus repository</id>
<url>http://insecure.repo1.maven.org/maven2/</url>
</pluginRepository>
Just adding this in case it is useful to anyone.
You should update your maven version, the last maven version use https.
Download maven https://maven.apache.org/download.cgi (binary zip file) and extract it.
In netbeans, go to Tools -> Options -> Java -> Maven. In Maven Home select Browse, and select the folder where you extract maven
Enjoy it!
While the other responses give you workarounds by manually configuring the repository or a more recent version of Maven, the true source of the problem is that Netbeans (8.2) has became obsolete and is no more updated, you'd better migrate to Apache Netbeans (currently at version 11.3).
I fixed the issue by updating to latest maven version, it started to use https instead of http to download all the deps.
I changed maven version for global netbeans configuration Tools -> Options -> Java ->Maven ->Maven Home and Browse your maven installation of windows system (for example maven3.6) , i think so maven version embed netbeans 8.2 needs updated
Hello I'm trying to run mvn clean install, and I'm receiving a package does not exist error:
[DEBUG] Source roots:
[DEBUG] /Users/username/Projects/Venice/clarity/clarity-test-e2e/src/test/java
[DEBUG] Command line options:
[DEBUG] -d /Users/username/Projects/Venice/clarity/clarity-test-e2e/target/test-classes -classpath /Users/username/Projects/Venice/clarity/clarity-test-e2e/target/test-classes:/Users/username/Projects/Venice/clarity/clarity-test-e2e/target/classes:/Users/username/.m2/repository/uk/co/jemos/podam/podam/7.0.5.RELEASE/podam-7.0.5.RELEASE.jar:/Users/username/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/Users/username/.m2/repository/org/slf4j/slf4j-api/1.7.22/slf4j-api-1.7.22.jar:/Users/username/.m2/repository/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar:/Users/username/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar:/Users/username/.m2/repository/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar:/Users/username/.m2/repository/org/testng/testng/6.11/testng-6.11.jar:/Users/username/.m2/repository/com/beust/jcommander/1.64/jcommander-1.64.jar:/Users/username/.m2/repository/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar:/Users/username/Projects/Venice/clarity/clarity-etl/target/clarity-etl-1.0.0-SNAPSHOT.jar:/Users/username/Projects/Venice/clarity/clarity-statusserv/dao/target/clarity-statusserv-dao-1.0.0-SNAPSHOT.jar:/Users/username/Projects/Venice/clarity/clarity-statusserv/model/target/clarity-statusserv-model-1.0.0-SNAPSHOT.jar:/Users/username/.m2/repository/org/apache/commons/commons-collections4/4.1/commons-collections4-4.1.jar:/Users/username/.m2/repository/org/hibernate/hibernate-validator/5.4.1.Final/hibernate-validator-5.4.1.Final.jar:/Users/username/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar:/Users/username/.m2/repository/com/fasterxml/classmate/1.3.3/classmate-1.3.3.jar:/Users/username/.m2/repository/org/projectlombok/lombok/1.16.12/lombok-1.16.12.jar:/Users/username/.m2/repository/org/springframework/boot/spring-boot-starter/1.5.1.RELEASE/spring-boot-starter-1.5.1.RELEASE.jar:/Users/username/.m2/repository/org/springframework/boot/spring-boot/1.5.1.RELEASE/spring-boot-1.5.1.RELEASE.jar:/Users/username/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.5.1.RELEASE/spring-boot-autoconfigure-1.5.1.RELEASE.jar:/Users/username/.m2/repository/org/springframework/spring-core/4.3.6.RELEASE/spring-core-4.3.6.RELEASE.jar:/Users/username/.m2/repository/org/apache/httpcomponents/httpclient/4.5.3/httpclient-4.5.3.jar:/Users/username/.m2/repository/org/apache/httpcomponents/httpcore/4.4.6/httpcore-4.4.6.jar:/Users/username/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/Users/username/.m2/repository/commons-codec/commons-codec/1.10/commons-codec-1.10.jar:/Users/username/.m2/repository/org/springframework/boot/spring-boot-starter-log4j2/1.5.1.RELEASE/spring-boot-starter-log4j2-1.5.1.RELEASE.jar:/Users/username/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.7/log4j-slf4j-impl-2.7.jar:/Users/username/.m2/repository/org/apache/logging/log4j/log4j-api/2.7/log4j-api-2.7.jar:/Users/username/.m2/repository/org/apache/logging/log4j/log4j-core/2.7/log4j-core-2.7.jar:/Users/username/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.22/jcl-over-slf4j-1.7.22.jar:/Users/username/.m2/repository/org/slf4j/jul-to-slf4j/1.7.22/jul-to-slf4j-1.7.22.jar:/Users/username/.m2/repository/org/springframework/data/spring-data-couchbase/2.2.0.RELEASE/spring-data-couchbase-2.2.0.RELEASE.jar:/Users/username/.m2/repository/org/springframework/spring-context/4.3.6.RELEASE/spring-context-4.3.6.RELEASE.jar:/Users/username/.m2/repository/org/springframework/spring-aop/4.3.6.RELEASE/spring-aop-4.3.6.RELEASE.jar:/Users/username/.m2/repository/org/springframework/spring-beans/4.3.6.RELEASE/spring-beans-4.3.6.RELEASE.jar:/Users/username/.m2/repository/org/springframework/spring-expression/4.3.6.RELEASE/spring-expression-4.3.6.RELEASE.jar:/Users/username/.m2/repository/org/springframework/spring-web/4.3.6.RELEASE/spring-web-4.3.6.RELEASE.jar:/Users/username/.m2/repository/org/springframework/spring-tx/4.3.6.RELEASE/spring-tx-4.3.6.RELEASE.jar:/Users/username/.m2/repository/org/springframework/data/spring-data-commons/1.13.0.RELEASE/spring-data-commons-1.13.0.RELEASE.jar:/Users/username/.m2/repository/com/couchbase/client/java-client/2.3.7/java-client-2.3.7.jar:/Users/username/.m2/repository/com/couchbase/client/core-io/1.3.7/core-io-1.3.7.jar:/Users/username/.m2/repository/io/reactivex/rxjava/1.1.8/rxjava-1.1.8.jar:/Users/username/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.8.6/jackson-databind-2.8.6.jar:/Users/username/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.8.0/jackson-annotations-2.8.0.jar:/Users/username/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.8.6/jackson-core-2.8.6.jar:/Users/username/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.5.1.RELEASE/spring-boot-starter-web-1.5.1.RELEASE.jar:/Users/username/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.5.1.RELEASE/spring-boot-starter-tomcat-1.5.1.RELEASE.jar:/Users/username/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.11/tomcat-embed-core-8.5.11.jar:/Users/username/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.5.11/tomcat-embed-el-8.5.11.jar:/Users/username/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.11/tomcat-embed-websocket-8.5.11.jar:/Users/username/.m2/repository/org/springframework/spring-webmvc/4.3.6.RELEASE/spring-webmvc-4.3.6.RELEASE.jar: -sourcepath /Users/username/Projects/Venice/clarity/clarity-test-e2e/src/test/java: -s /Users/username/Projects/Venice/clarity/clarity-test-e2e/target/generated-test-sources/test-annotations -g -nowarn -target 1.8 -source 1.8 -encoding UTF-8
[DEBUG] incrementalBuildHelper#beforeRebuildExecution
[INFO] Compiling 3 source files to /Users/username/Projects/Venice/clarity/clarity-test-e2e/target/test-classes
[DEBUG] incrementalBuildHelper#afterRebuildExecution
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/username/Projects/Venice/clarity/clarity-test-e2e/src/test/java/com/company/consumer/tools/clarity/e2e/etl/ETLHappyPathSuite.java:[6,58] package com.company.consumer.tools.clarity.etl.dao.v1.state does not exist
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Clarity - Parent Pom ............................... SUCCESS [ 0.256 s]
[INFO] Clarity - Status Service Parent Pom ................ SUCCESS [ 0.007 s]
[INFO] Clarity - Status Service Model ..................... SUCCESS [ 2.416 s]
[INFO] Clarity - Status Service DAO Components ............ SUCCESS [ 0.693 s]
[INFO] Clarity - Status Service ........................... SUCCESS [ 2.119 s]
[INFO] Clarity - Checkstyle Configuration ................. SUCCESS [ 0.034 s]
[INFO] Clarity - ETL ...................................... SUCCESS [ 0.776 s]
[INFO] Clarity - Testing E2E .............................. FAILURE [ 0.216 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.039 s
[INFO] Finished at: 2017-06-05T11:47:36-07:00
[INFO] Final Memory: 47M/536M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project clarity-test-e2e: Compilation failure
[ERROR] /Users/username/Projects/Venice/clarity/clarity-test-e2e/src/test/java/com/company/consumer/tools/clarity/e2e/etl/ETLHappyPathSuite.java:[6,58] package com.company.consumer.tools.clarity.etl.dao.v1.state does not exist
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project clarity-test-e2e: Compilation failure
/Users/username/Projects/Venice/clarity/clarity-test-e2e/src/test/java/com/company/consumer/tools/clarity/e2e/etl/ETLHappyPathSuite.java:[6,58] package com.company.consumer.tools.clarity.etl.dao.v1.state does not exist
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
/Users/username/Projects/Venice/clarity/clarity-test-e2e/src/test/java/com/company/consumer/tools/clarity/e2e/etl/ETLHappyPathSuite.java:[6,58] package com.company.consumer.tools.clarity.etl.dao.v1.state does not exist
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:858)
at org.apache.maven.plugin.compiler.TestCompilerMojo.execute(TestCompilerMojo.java:152)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :clarity-test-e2e
The dependency 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 -->
<!-- ================================================================== -->
<parent>
<groupId>com.company.consumer.tools.clarity</groupId>
<artifactId>clarity-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<!-- ================================================================== -->
<!-- Application Description -->
<!-- ================================================================== -->
<artifactId>clarity-etl</artifactId>
<packaging>jar</packaging>
<name>Clarity - ETL</name>
<description>
</description>
<properties>
<app.mainClass>com.company.consumer.tools.clarity.etl.ETLMain</app.mainClass>
<docker.image.prefix>dockerhub.companycorp.com/username</docker.image.prefix>
</properties>
<!-- ================================================================== -->
<!-- Dependencies -->
<!-- ================================================================== -->
<dependencies>
<!-- ================================================================== -->
<!-- Clarity Dependencies -->
<dependency>
<groupId>com.company.consumer.tools.clarity</groupId>
<artifactId>clarity-statusserv-dao</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<!-- ================================================================== -->
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!-- ================================================================== -->
<!-- Build -->
<!-- ================================================================== -->
<build>
<plugins>
<!-- ================================================================== -->
<!-- Invoke spring boot application. -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>${app.mainClass}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<configuration>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<useConfigFile>true</useConfigFile>
<registryUrl>https://dockerhub.companycorp.com/</registryUrl>
</configuration>
</plugin>
</plugins>
</build>
</project>
Now
👾 👾 [username]#[localhost] (master)$jar -tf
/Users/username/.m2/repository/com/company/consumer/tools/clarity/clarity-
etl/1.0.0-SNAPSHOT/clarity-etl-1.0.0-SNAPSHOT.jar | grep dao
BOOT-INF/classes/com/company/consumer/tools/clarity/etl/dao/
BOOT-INF/classes/com/company/consumer/tools/clarity/etl/dao/v1/
BOOT-INF/classes/com/company/consumer/tools/clarity/etl/dao/v1/state/
BOOT-INF/classes/com/company/consumer/tools/clarity/etl/dao/v1/
state/EtlStateDocument.class
BOOT-INF/classes/com/company/consumer/tools/clarity/etl/dao/v1/
state/EtlStateRepository.class
After running mvn dependency:build-classpath I can see clarity-etl-1.0.0-SNAPSHOT.jar (the dependency) is on the classpath.
Here is the dependent 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 -->
<!-- ================================================================== -->
<parent>
<groupId>com.company.consumer.tools.clarity</groupId>
<artifactId>clarity-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<!-- ================================================================== -->
<!-- Project Settings -->
<!-- ================================================================== -->
<artifactId>clarity-test-e2e</artifactId>
<name>Clarity - Testing E2E</name>
<description>
The end to end testing for Clarity.
</description>
<properties>
<org.apache.maven.surefire.version>2.19.1</org.apache.maven.surefire.version>
</properties>
<!-- ================================================================== -->
<!-- Distribution Management -->
<!-- ================================================================== -->
<distributionManagement>
<repository>
<id>releases</id>
<name>Internal Nexus Releases</name>
<url>http://nexus.company.com/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal Nexus Snapshots</name>
<url>http://nexus.company.com/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<!-- ================================================================== -->
<!-- Repositories -->
<!-- ================================================================== -->
<repositories>
<repository>
<id>company-nexus</id>
<name>company Nexus</name>
<layout>default</layout>
<url>http://nexus.company.com/nexus/content/groups/public-all/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>uk.co.jemos.podam</groupId>
<artifactId>podam</artifactId>
<version>7.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
<dependency>
<groupId>com.company.consumer.tools.clarity</groupId>
<artifactId>clarity-etl</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
<!-- ================================================================== -->
<!-- Build -->
<!-- ================================================================== -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>e2e</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${org.apache.maven.surefire.version}</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>${org.apache.maven.surefire.version}</version>
</dependency>
</dependencies>
<configuration>
<systemPropertyVariables>
<dbhost>${dbhost}</dbhost>
<dbuser>${dbuser}</dbuser>
<dbpass>${dbpass}</dbpass>
<saasEndpoint>${saasEndpoint}</saasEndpoint>
<cssEndpoint>${cssEndpoint}</cssEndpoint>
</systemPropertyVariables>
<suiteXmlFiles>
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
<parallel>all</parallel>
<useUnlimitedThreads>true</useUnlimitedThreads>
<properties>
<property>
<name>suitethreadpoolsize</name>
<value>20</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
I'm not sure why this is not building correctly using mvn clean install from command line, but it appears to work perfectly fine when I execute from eclipse. I think Eclipse, by default, provides all classes on classpath (regardless of scope), but I've tried different scopes to no avail.
Any help would be greatly appreciated. Thanks in advance!
You cannot use clarity-etl-1.0.0-SNAPSHOT.jar as a regular jar dependency. Notice that the classes in this jar are under BOOT-INF/classes, which is used by Spring Boot but ignored by the Java compiler.
If your goal is to test the Spring Boot application (as opposed to using the jar as a dependency), then Spring Boot provides easy ways to do it.
See, for example https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-testing.html.
If, on the other hand, it is important to include the classes in another application, then How to add a dependency to a Spring Boot Jar in another project? might help as you pointed out in the comments.
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.
I have the following pom.xml (see below) for building a web-app on JBoss. I run maven like this :
mvn clean compile war:exploded jboss:hard-undeploy jboss:hard-deploy jboss:start-and-wait
Every goals run fine until i hit jboss:start-and-wait goal :\ JBoss refuses to start.
I got the following error :
(...)
[INFO] [jboss:start-and-wait {execution: default-cli}]
[INFO] Starting JBoss...
[INFO] Waiting to retrieve JBoss JMX MBean connection...
[INFO] Waiting to retrieve JBoss JMX MBean connection...
[INFO] Waiting to retrieve JBoss JMX MBean connection...
[INFO] Waiting to retrieve JBoss JMX MBean connection...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Unable to get JBoss JMX MBean connection: null
org.jboss.jmx.adaptor.rmi.RMIAdaptor
(...)
By activating the DEBUG option on maven, i detected that the root cause is a ClassNotFoundException
org.jboss.jmx.adaptor.rmi.RMIAdaptor. Why do I get this exception since my pom.xml
does contain org.jboss.jmx.adaptor.rmi.RMIAdaptor in the jmx-adaptor-plugin jar dependency ?
Using jboss-all-client jar as dependency gives no more results.
What am I missing ?
Stephan
Configuration
Maven 2.2.1
JBoss 5.1.0.GA
JBoss Maven Plugin 1.5.0
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>
<parent>
<artifactId>foo</artifactId>
<groupId>com.company.foo</groupId>
<version>1.0.0</version>
</parent>
<groupId>com.company.foo</groupId>
<artifactId>foo-webapp</artifactId>
<packaging>war</packaging>
<name>foo-webapp</name>
<version>1.0.0</version>
<dependencies>
<!-- JSF 2.0 -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.3-b02</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.3-b02</version>
</dependency>
<!-- Primefaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<!-- <version>3.0.M1</version> -->
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>redmond</artifactId>
<version>1.0.0</version>
</dependency>
<!-- Others -->
<dependency>
<groupId>com.company.record</groupId>
<artifactId>record-dao</artifactId>
<version>1.0.0</version>
</dependency>
<!-- Postgresql -->
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>8.3-606.jdbc4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jmx-adaptor-plugin</artifactId>
<version>3.2.1</version>
</dependency>
</dependencies>
<build>
<finalName>foo.war</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<useCache>false</useCache>
<!-- Prevent a bug from plugin (see http://jira.codehaus.org/browse/MWAR-248) -->
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<fileName>${project.build.directory}/${project.build.finalName}</fileName>
<serverName>web</serverName>
</configuration>
</plugin>
</plugins>
</build>
(...)
Try adding it to your plugin dependencies:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<fileName>${project.build.directory}/${project.build.finalName}</fileName>
<serverName>web</serverName>
</configuration>
<dependencies>
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
<type>pom</type>
<version>5.1.0.GA</version>
</dependency>
</dependencies>
</plugin>