Class library resolving error in endpoints-framework:discoveryDocs - google-cloud-endpoints-v2

I am trying to migrate my project from endpoints v1 to endpoints v2 but cannot create discovery docs. running
$ mvn -DskipTests -X endpoints-framework:discoveryDocs
leads to a build failure
[ERROR] Failed to execute goal com.google.cloud.tools:endpoints-framework-maven-plugin:1.0.0:discoveryDocs (default-cli) on project myproject: Execution default-cli of goal com.google.cloud.tools:endpoints-framework-maven-plugin:1.0.0:discoveryDocs failed: A required class was missing while executing com.google.cloud.tools:endpoints-framework-maven-plugin:1.0.0:discoveryDocs: org/apache/commons/dbutils/ResultSetHandler
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>com.google.cloud.tools:endpoints-framework-maven-plugin:1.0.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/me/.m2/repository/com/google/cloud/tools/endpoints-framework-maven-plugin/1.0.0/endpoints-framework-maven-plugin-1.0.0.jar
[ERROR] urls[1] = file:/Users/me/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
...
I can see that the respective .jar file is in the -cp parameters:
..., /Users/me/.m2/repository/commons-dbutils/commons-dbutils/1.6/commons-dbutils-1.6.jar, ...
but not in the error urls (urls[0..48] = ...)
Building and testing runs correctly (mvn verify etc), so the libraries do actually exist and work, but I think it cannot actually run without discovery docs.
Any ideas what I could have missed? There seem to be a huge number of .jar files in that classpath, is there some limit?

You have to update the endpoints-framework-maven-plugin to version 1.0.1:
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>endpoints-framework-maven-plugin</artifactId>
<version>1.0.1</version>
<configuration>
<!-- plugin configuration -->
<hostname>YOUR-APPP-ID.appspot.com</hostname>
</configuration>
</plugin>
There was a bug in version 1.0.0, see here:
https://github.com/GoogleCloudPlatform/endpoints-framework-maven-plugin/issues/32

Related

How to fix Missing requirement for javax.imageio while building Eclipse-CDT using Maven?

I downloaded the eclipse cdt source package org.eclipse.cdt-CDT_9_8_1.tar.xz from https://git.eclipse.org/c/cdt/org.eclipse.cdt.git and using maven 3.6.1 i tried to build it with command mvn clean install. Some packages were downloaded from repos and at the end it exited with the below error message
I need to build cdt from source as i want some changes in CDT source code. I am not an expert in Maven, not sure what's going wrong. Please help to resolve the issue
[INFO] Resolving dependencies of MavenProject: org.eclipse.cdt:org.eclipse.cdt.build.gcc.core:1.0.1-SNAPSHOT # D:\Eclipse\Sources\CDT9.8.1_GIT\cdt-releng\org.eclipse.cdt\build\org.eclipse.cdt.build.gcc.core.polyglot.build.properties
[ERROR] Cannot resolve target definition:
[ERROR] Software being installed: com.sun.xml.bind 2.2.0.v201505121915
[ERROR] Missing requirement: com.sun.xml.bind 2.2.0.v201505121915 requires 'java.package; javax.imageio 0.0.0' but it could not be found
[ERROR] Failed to resolve target definition D:\Eclipse\Sources\CDT9.8.1_GIT\cdt-releng\org.eclipse.cdt\releng\org.eclipse.cdt.target\cdt.target: See log for details -> [Help 1]
[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] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException
The issue here is, that some plugins do not define a RequiredExecutionEnvironment. If such a plugin depends on a JRE package the build fails with the given error.
In Tycho it is possible to define such an environment:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<!-- needed as some plugins do not set a execution environment they would fail to get jre packages (eg. javax.imageio) -->
<executionEnvironment>JavaSE-1.8</executionEnvironment>
</configuration>
</plugin>

maven could not resolve project dependencies?

When i try to make a mvn deploy i am getting this error:
[ERROR] Failed to execute goal on project cross-automation-config: Could not resolve dependencies for project com.desp.cross.commons:cross-automation-config:jar:0.0.1-SNAPSHOT: Failed to collect dependencies for [com.desp.qc:automation-commons-config:jar:0.0.7 (compile), com.desp.cross.commons:cross-automation-utils:jar:0.0.1-SNAPSHOT (compile)]: Failed to read artifact descriptor for com.desp.cross.commons:cross-automation-utils:jar:0.0.1-SNAPSHOT: Failure to find com.desp.cross.commons:cross-automation-commons:pom:0.0.1-SNAPSHOT in http://repo.jenkins-ci.org/public/ was cached in the local repository, resolution will not be reattempted until the update interval of repo.jenkins-ci.org 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
Into the project (cross-automation-config) i have these dependencies
<dependency>
<groupId>com.desp.qc</groupId>
<artifactId>automation-commons-config</artifactId>
</dependency>
<dependency>
<groupId>com.desp.cross.commons</groupId>
<artifactId>cross-automation-utils</artifactId>
</dependency>
This project has a parent project, which i don't considerate necessary to put in here.
I know that this is a dependencies problem. What i don't understand is why eclipse can download those dependencies, without any error, and maven can not
Do you have an idea about what is going on?
It looks like your maven is not able to find this dependencies in your local repository.
You should try to build first those two projects: automation-commons-config and cross-automation-utils (be careful if there are dependent in each other).

Trouble with the sonar-packaging-maven-plugin after refactoring

I have some trouble developing a plugin for my company, later called as "myPlugin".
Background:
I was reading the book "SonarQube in Action" by the Manning company.
There was a little guide for developing a own plugin (they used the redmine plugin as example for developing). It told me to use the sonar-plugin-archetype to create the basic framework.
Situation before refactoring:
I wrote the plugin and it works fine. I encountered the problem when I've done some refactoring. Before the refactoring every package in the src folder in my tree (using ecplise) was called "main.java.org.sonar.plugins.myplugin" but the package decleration within each class was "org.sonar.plugins.myplugin". This were default settings created by using the sonar-plugin-archetype.
The settings within the pom.xml of the sonar-packaging-maven-plugin were the following once.
Pom-snippet before any changes were done:
<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-packaging-maven-plugin</artifactId>
<version>1.9</version>
<extensions>true</extensions>
<configuration>
<pluginClass>org.sonar.plugins.myplugin.myPlugin</pluginClass>
</configuration>
</plugin>
So far everything worked fine. Now we come to my problem.
Situation after refactoring:
As my company has some naming conevtions for classes and packages i changed the package names in the tree to "com.mycompany.sonar.plugins.myplugin" and the package decleration within each class also to "com.mycompany.sonar.plugins.myplugin". Then i changed the classPath option for the sonar-packaging-maven-plugin to "com.mycompany.sonar.plugins.myplugin.myPlugin". All I've done so to say was changing "org." into "com.mycompany.".
Pom-snippet after changes were done:
<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-packaging-maven-plugin</artifactId>
<version>1.9</version>
<extensions>true</extensions>
<configuration>
<pluginClass>com.mycompany.sonar.plugins.myplugin.myPlugin</pluginClass>
</configuration>
</plugin>
When i was running the "compile" command everything worked. Using "package" does not work, because the sonar-packaging-maven-plugin was not able to find the given class (see console output below). When i'm refoactoring everything again back to the beginning it works again.
[...]
[INFO] --- sonar-packaging-maven-plugin:1.9:sonar-plugin (default-sonar-plugin) # sonar-projectkeychecker-plugin ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.649 s
[INFO] Finished at: 2014-04-02T11:42:01+01:00
[INFO] Final Memory: 13M/67M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.sonar:sonar-packaging-maven-plugin:1.9:sonar-plugin (default-sonar-plugin) on project sonar-myplugin-plugin: Plugin class not found: 'com.mycompany.sonar.plugins.myplugin.myPlugin-> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
My Question: Why are my new names not working? Are there any inner convetions for the sonar-packaging-maven-plugin (like the packaging name has to beginn with "org.sonar" ot something like this)?
Thank you for reading this long text and your try to help me :)
pluginClass is the entry point of the plugin. Value must be an existing class. In your example I suppose that there's a typo, it should be com.mycompany.sonar.plugins.myplugin.MyPlugin (upper-case M).
Under <plugin> I was missing the <extensions>true</extensions> tag

Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1:war - Could not copy resource

I have a multi-module project that I'm trying to import in my Ubuntu 12.04 LTS's Eclipse Juno. (I already have done it successfully on Windows 7).
My project has six modules, the first four modules are successfully imported from the SVN Repository and built with Maven 3.0.5, but when I try to build the fifth called core, i receive the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1:war (default-war) on project core: Could not copy resource [/opt/workspace/core/target\preassembly]: File /opt/workspace/core/target\preassembly/scripts/Mask.js does not exist -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
As the error says, It looks like that Maven can't find the directory /opt/workspace/core/target\preassembly to copy the file /opt/workspace/core/target\preassembly/scripts/Mask.js.
But, this directory actually exists and the file Mask.js is in there. What looks strange to me is that backslash \ after target directory instead a common bar /. But I have no idea if this is a problem and how to solve it, I spent 2 days researching the Internet but unfortunately I've found nothing.
Here's my maven-war-plugin configuration section of parent project's pom.xml, where the backslashes appear
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
<configuration>
<webResources>
<resource>
<directory>${project.build.directory}\preassembly</directory>
</resource>
</webResources>
</configuration>
</plugin>
I've also checked the owner of the directories on Ubuntu, and everything refers to the same owner that worked on the first four modules.
As I said above, the same version of eclipse, svn and maven works great on Windows.
Anyone ever had this problem? Thank you very much.
I was working on angular 8 and updated the code to angular 9 and then during build i got the same issue .For me clean build solved the issue.You can try clean build , hope that will help .

Run Tomcat with Maven and Eclipse - Unknown lifecycle phase

I am using Eclipse Helios,Tomcat Server 7. I have build my project using Maven. When I try to build my project, I get the below error in Eclipse.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building encore Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.095s
[INFO] Finished at: Tue Nov 06 18:17:55 IST 2012
[INFO] Final Memory: 2M/36M
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "build". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [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/LifecyclePhaseNotFoundException
Please let me know what is wrong in my code and kindly point to right directions. I need to figure it out ASAP.
<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.encore</groupId>
<artifactId>encore</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>encore Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
</dependency>
</dependencies>
<build>
<finalName>encore</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>2.9</version>
<configuration>
<server>mytomcatserver</server>
<path>/encore</path>
<url>http://localhost:8080</url>
<username>admin</username>
<password>admin</password>
</configuration>
</plugin>
</plugins>
</build>
</project>
This is my pom.xml. I am trying to Run my application as Run as-> mvn build from eclipse.
It sounds like you've accidentally set the wrong goal when trying to build from Eclipse. Edit your Maven "Run as.." settings like so:
Note the clean install which will run the Maven commands to clean your build and do a full build and install into the local repository.
Try mvn install instead of mvn build. build is not a valid option for Maven. You can find a list of valid options in the error message above.
If you just want to compile the sources, try mvn compile but that will usually produce an incorrect result when you have more than one pom.xml file in your project.
You should build : install , not build : mvn install ,not start with mvn ...
All ides ( Eclipse, Intellij etc.) have some problems with maven build, instead of using bundled maven component, use command-line maven.
In command line ( windows or linux console does not matter.) mvn clean, then mvn install will fix your problem. Command line usage can be change your view point of maven.
It is most probable you set incorrect goals in the configuration when you ran "run as" "Maven build" and now can't change it.
Right click on the project -> run as -> Run configurations.
A picture to illustrate: https://i.stack.imgur.com/Ry65K.png
This will bring back up the window you first had on your first build and you can then follow the instructions of the more experienced contributors above.
Hope this helps.
Error: org.apache.maven.lifecycle.LifecyclePhaseNotFoundException
For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException
Solution : Unknown lifecycle phase or wrong goal example:First I am using "clean package tea-container-test:tomcat-test -P "XXX" -e" as goalĀ , then I changed a goal as "test -P XXX" , then It works perfectly,so Please check , your goal is right or wrong.
"Creates a new exception to indicate that the specified lifecycle phase is not defined by any known lifecycle".
I also had the same problem, uninstall the GIT bash and install again. This will resolve EnvVar issue is any.
If still not solved, please check with your commands. Copy and paste your commands from notepad and this should work