Maven Build failure in command prompt but getting build in eclipse - java

I am using mvn clean command from the command prompt and build is failing.
Downloading:
https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-
plugin/2.5/maven-clean-plugin-2.5.pom
[INFO] Reactor Summary:
[INFO] ABC ......................................... FAILURE [ 2.226 s]
[INFO] BUILD FAILURE
[INFO] Total time: 3.098 s
[INFO] Finished at: 2018-11-16T15:10:36+05:30
[INFO] Final Memory: 12M/153M
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of
its
dependencies could not be resolved: Failed to read artifact descriptor for
org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer
artifact
org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central
(https://repo.maven.apache.org/maven2): Received fatal alert:
protocol_version -
> [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] For more information about the errors and possible solutions,
please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
But when I am using mvn clean command from inside of eclipse it is building successfully.
[INFO] ---------------------------------------------------------------------
---
Downloading:
http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-
plugin/2.4.1/maven-clean-plugin-2.4.1.pom
Downloaded:
http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-
plugin/2.4.1/maven-clean-plugin-2.4.1.pom (5 KB at 5.2 KB/sec)
-------------------------
[INFO] BUILD SUCCESS
[INFO] Total time: 4.387s
The difference i am able to see is that , in command prompt it is trying to download maven-clean-plugin-2.5 whereas from eclipse it is successfully downloading 2.4.1
But I need to run through 2.5 only .
Can anyone help me on this.
Thanks.

I don't know did you install maven globally. You can try to install maven globally. follow the steps.
Download maven from maven download link
Create or export M2_HOME="MAVEN ROOT LOCATION". Ex. : E:\SoftwareRepo\building tools\apache-maven-3.5.2
Create or export MAVEN bin folder location to PATH variable. For example: E:\SoftwareRepo\building tools\apache-maven-3.5.2\bin
Open terminal or cmd and run mvn --version to confirm maven is installed or not.
You can use this same as with Eclipse.
Then go to eclipse. and setup project.follow this steps
Import existing maven project or create a maven project
Goto project explorer and Right click on your pom.xml
then select Run As maven install.
and then what you want.
Hope it will serve your purpose. You can download a sample spring boot project .
Or you can run a maven project from terminal or cmd. Just goto project root folder and then run a maven task like maven clean install . Happy Coding :)

Related

Apache Flink with AWS Kinesis Analytics

The actual situation
I want to use Apache Flink with Kinesis Analytics. Like I don't have experience with Java and Maven and going to try to summary the steps I followed and the results.
Use IntelliJ IDEA as IDE
Test this example without any problems
Change to AWS, following their instruction. The problems start in the step: Create and Compile the Apache Flink Streaming Java Code
The problems
If you want to use the Kinesis connector, you can not do it like other connector due to the ASL license and they do not deploy the artifact to the Maven central repository on Flink releases, so you will need to build the Kinesis connector by yourself download the source code for the connector from here Apache Flink, and install it to your local Maven repository.
After download it, you have build the module following this steps:
mvn clean install -Pinclude-kinesis -DskipTests
So I move to the unziped folder, and run the mvn command, with this error:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 50.670 s
[INFO] Finished at: 2018-12-27T14:35:13+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.12:check (default) on project flink-parent: Too many files with unapproved license: 2 See RAT report in: C:\Users\...\flink-master\target\rat.txt -> [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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :flink-parent
Trying to find a solution, I tried what this user said here
mvn clean install -Pinclude-kinesis -DskipTests -Drat.ignoreErrors=true package
But again, I had an error:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:15 min
[INFO] Finished at: 2018-12-27T14:40:47+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project flink-shaded-hadoop2: Could not resolve dependencies for project org.apache.flink:flink-shaded-hadoop2:jar:1.8-SNAPSHOT: Could not find artifact jdk.tools:jdk.tools:jar:1.6 at specified path C:\Program Files\Java\jdk-11/../lib/tools.jar -> [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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :flink-shaded-hadoop2
The questions
How should I build the connector module?
How should I install it to my local Maven repository?
After receiving similar errors, even after using the other answer's solution for checking out a release branch, I found a solution that works for me. According to the build guide in the Flink docs, you can also add the -Dfast option to speed up build time. In my case, this resolved the licensing errors:
mvn clean install -Pinclude-kinesis -DskipTests -Dfast
I think that the problem is that you're trying to build the "snapshot" build of the Flink connector, not the release build.
Since you're not familiar with Java and Maven, here's what that means: Maven differentiates between "snapshot" builds, which are currently under active development, and "release" builds. Normally a project only pushes its release builds to Maven Central. However, for long-running development, the "master" branch is often a snapshot.
The POM in your linked instructions references version 1.6.2, so that's what you should be building. Check out the tag release-1.6.2, and also make sure that you're reading the Flink documentation for that version (your link above is for the latest development version).

Angular7 + maven with IBM websphere error (frontend-maven-plugin:1.0:npm (npm install fail))

I have a complete angular7 project and want to integrate with java.
is there any way to do it?
I am using eclipse maven + ibm websphere. (not spring boot)
I referred this post(by #TimeTraveler) and tried to follow...
however when I run command mvn clean package, I encounter this error
[INFO] --- frontend-maven-plugin:1.0:npm (npm install) # angular7test ---
[INFO] Running 'npm install' in C:\Users\eclipse-workspace\angular7test\angular-project
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:01 min
[INFO] Finished at: 2018-11-29T23:16:03+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.0:npm (npm install) on project angular7test: Failed to run task: 'npm install' failed. java.io.IOException: Cannot run program "C:\Users\eclipse-workspace\angular7test\node_installation\node\node.exe" (in directory "C:\Users\eclipse-workspace\angular7test\angular-project"): CreateProcess error=267, The directory name is invalid -> [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
and I also have a question .. based on that post, maven project looks like below
Maven Project -
src
main
java
resources
webapp
WEB-INF
web.xml
angular-project (I paste my angular project here)
node_installation ========>what is this?????
pom.xml
what is node_installation? .. is that a folder? do i need to create?
this is my package..
The error you posted indicates that Maven can't find the node.js executable node.exe in order to build your Angular project. Make sure you configure your pom as indicated on the frontend-maven-plugin readme page so that it will install node and npm into your project dir where maven expects to find it. This will create the node_installation directory you are missing and populate it with the node.exe executable, which should resolve the error.

jenkins Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli)

[INFO] Verifying that there are no local modifications...
[INFO] ignoring changes on: **/pom.xml.backup, **/release.properties, **/pom.xml.branch, **/pom.xml.next, **/pom.xml.releaseBackup, **/pom.xml.tag
[INFO] Executing: /bin/sh -c cd /opt/Jenkins/ic/jenkins/jobs/util/workspace && git status
[INFO] Working directory: /opt/Jenkins/ic/jenkins/jobs/util/workspace
[INFO] Checking dependencies and plugins for snapshots ...
[INFO] Transforming 'my_proyect'...
[INFO] Not generating release POMs
[INFO] Executing goals 'clean verify'...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:23.375s
[INFO] Finished at: Wed Jan 22 15:21:16 ECT 2014
[JENKINS] Archiving /opt/Jenkins/ic/jenkins/jobs/util/workspace/pom.xml to xx.xxx.xxxx/my_proyect/1.0.2-SNAPSHOT/my_proyect-1.0.2-SNAPSHOT.pom
[INFO] Final Memory: 16M/246M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project my_proyect: Could not create temporary file for release settings.xml: Permission denied -> [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
channel stopped
Finished: FAILURE
I need help.
When built a snapshot does not give me problems, but if I want to generate a release I get the above log.
I have the jenkins 1.548
maven 3.1.1
nexus 2.7.0-0
Jenkins + maven-release-plugin + settings.xml = painful
Check the following locations for any mention or overrides of settings.xml file:
Jenkins
instance-level config
general Maven section
Maven release plugin section
job-level config
general Maven section
Maven release plugin section
pom.xml file
maven-release-plugin section
profiles section
In addition, things can get fussy depending on how you're running the job in Jenkins:
freestyle job with Maven goals
Maven job using regular "Build" button with "release:prepare" goals
Maven build using "Run Maven Release" button
Try experimenting with different job types.

Generating jar file using maven in db unit installation

I need to install db unit in my system. I have completed installing JDBC driver. i have downloaded junit-4.11.jar.
I have to generate the jar file into the directory.What is the correct method/step of doing this.AS per the link:
http://www.dbunit.org/building.html
i tried to run the command mvn from command line.
But i get the error
C:\Users\suvin>mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.225s
[INFO] Finished at: Tue Nov 20 14:51:56 IST 2012
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM
in this directory (C:\Users\suvin). Please verify you invoked Maven from the co
rrect directory. -> [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/MissingProject
Exception
Any help would be appreciated
Is dbUnit dependency is included in the POM file, if so mvn install does what you are expecting it to do
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>2.4.3</version>
</dependency>
it seems C:\Users\suvin location doesn't have pom file, Before execute "mvn install" your command prompt should be in place where your POM file exist.
For your information.
Normaly from a source codes you can build(compile) it and get your jars. To build a source codes you can use either ant or maven which are some build tools in java. Source codes providers provide their source codes with build.xml or pom.xml or both. You could use your build technology to compile that java source and get jar from it.
you can learn ant and maven from the web

what's the matter about appfuse,please

when run the command:mvn jetty:run in the web directory,it's the error message:
[WARNING] The POM for com.mycompany:core:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.015s
[INFO] Finished at: Mon Sep 05 23:31:23 CST 2011
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project web: Could not resolve dependencies for project com.mycompany:web:war:1.0-SNAPSHOT: Failure to find com.myco
mpany:core:jar:1.0-SNAPSHOT in http://oss.sonatype.org/content/repositories/appfuse-snapshots was cached in the local repository, resolution will not
be reattempted until the update interval of appfuse-snapshots 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
It looks like you have appfuse multi-module web project and you are building the web module without having built/installed the core module.
Quoting the instruction from appfuse quickstart, highlighting relevant portion in bold.
To view your application run mvn jetty:run from your project's
directory (for a modular project, you'll need to run mvn jetty:run
from your project's web directory (after installing the core module)).
You need to run mvn install from the project's root directory also!
In your situation, you definitely need to mvn install from your core directory. If this does not help, then run the same command from root directory. The problem is that one of Your modules needs to be installed and only after that the error you are encountering will be removed.

Categories