I'm just getting started with jersey and have built the jersey 2.0 skeleton webapp using maven.
The command being:
mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archetypes \
-DarchetypeArtifactId=jersey-quickstart-webapp -DarchetypeVersion=2.0
Now if I try to execute this using mvn clean exec:java I get the following error:
[INFO] ------------------------------------------------------------------------
[INFO] Building testwebservice 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # testwebservice ---
[INFO] Deleting /Volumes/data/Projects/TestWebService/testwebservice/target
[INFO]
[INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) # testwebservice >>>
[INFO]
[INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) # testwebservice <<<
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) # testwebservice ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.627s
[INFO] Finished at: Sat Jun 22 17:46:18 CEST 2013
[INFO] Final Memory: 8M/125M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project testwebservice: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java are missing or invalid -> [Help 1]
The help provided isn't very helpful and I can't seem to find anything about this on the web. I have no clue where to set the parameters mainClass for "goal" (whatever that means) org.codehaus... . This is my first maven project and I'm pretty lost
Thanks for the help guys
You have generated a WEB Project and you are trying to run a java Application.
If you have a look at the Exec Plungin Documentation you will find that it requires an mainClassargument
and that's what the error message tells you
The parameters 'mainClass' for goal
org.codehaus.mojo:exec-maven-plugin:1.2.1:java are missing or invalid
But as I've already written you have generated a WEB Application Skeleton running it as Java Application does not really make sense.
Have a look at Building Simple Jersey Web App With Maven to find out what you'll have to do to get your web application running.
Try to run the following command using command line by going inside your project directory:
mvn clean generate-sources package
Related
I am having difficulty in getting this ojdbc7 JAR file installed in the correct location. I tried the following from Windows 10 command prompt and got the BUILD SUCCESS message as shown below:
C:\Users\john>mvn install:install-file -Dfile=C:\ojdbc7.jar -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.1 -Dpackaging=jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) # standalone-pom ---
[INFO] Installing C:\ojdbc7.jar to C:\Users\l-john\.m2\repository\com\oracle\ojdbc7\12.1.0.1\ojdbc7-12.1.0.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.381 s
[INFO] Finished at: 2018-10-24T12:09:04-05:00
[INFO] ------------------------------------------------------------------------
However, when I went inside the 12.1.0.1 folder (located here C:\Users\john\.m2\repository\com\oracle\ojdbc7\12.1.0.1) I only saw the following files :
For one of my Maven project, eclipse(version 2018-19) is trying to access the JAR file and I keep getting following BUILD FAILURE message which is obvious since the file isn't there:
BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.208 s
[INFO] Finished at: 2018-10-24T12:15:39-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project MyProject: Could not resolve dependencies for project com.company.ii:MyProject:war:0.1: Could not find artifact com.oracle.jdbc:ojdbc7:jar:12.1.0.1 in spring-releases (https://repo.spring.io/libs-release) -> [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.
In my pom.xml, I do have the dependency defined as follows:
Is there anything I am doing wrong? Please let me know if I need to perform some additional testing?
I could see that in mvn install command -DgroupId is not correct, instead of giving "-DgroupId=com.oracle.jdbc", you have given just "-DgroupId=com.oracle"
Maven tells you it is installing the jar to
C:\Users\l-john\.m2\repository\com\oracle\ojdbc7\12.1.0.1\ojdbc7-12.1.0.1.jar
But you are looking at
C:\Users\john\.m2\repository\com\oracle\ojdbc7\12.1.0.1
l-john vs john
I'm using Vaadin and the vaadin-maven-plugin to build a project with front files.
When I am running the goal locally I have no errors and the project builds successfully:
[INFO] Installed Yarn locally.
[INFO] Running 'yarn install' in /home/kaa/Documents/Projects/limitmanager.front/target
[INFO] yarn install v1.6.0
[INFO] [1/4] Resolving packages...
[ERROR] warning babel-preset-env > browserslist#2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
[INFO] [2/4] Fetching packages...
[INFO] [3/4] Linking dependencies...
[ERROR] warning "polymer-build > polymer-project-config#3.13.0" has incorrect peer dependency "polymer-analyzer#^3.0.0-pre.17 || ^3.0.0".
[INFO] [4/4] Building fresh packages...
[INFO] success Saved lockfile.
[INFO] Done in 7.12s.
[INFO] Processing frontend files from '/home/kaa/Documents/Projects/limitmanager.front/target/frontend'
[INFO] Running 'gulp build_es6' in /home/kaa/Documents/Projects/limitmanager.front/target
[INFO] [12:28:51] Using gulpfile ~/Documents/Projects/limitmanager.front/target/gulpfile.js
[INFO] [12:28:51] Starting 'build_es6'...
[INFO] Deleting /home/kaa/Documents/Projects/limitmanager.front/target/classes/META-INF/resources/frontend-es6 directory...
[INFO] [12:28:51] Finished 'build_es6' after 5.17 ms
[INFO] Starting to process frontend files.
[INFO] Will minify frontend files.
[INFO] Will bundle frontend files.
[INFO] Will hash bundle file names.
[INFO] Will copy files to target directory '/home/kaa/Documents/Projects/limitmanager.front/target/classes/META-INF/resources/frontend-es6'.
[INFO] Starting operations stated above, this might take a while.
[INFO] Writing bundle manifest to '/home/kaa/Documents/Projects/limitmanager.front/target/classes/META-INF/resources/frontend-es6/vaadin-flow-bundle-manifest.json'
But, running on gitlab CI causes an error:
Caused by: com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutionException: java.io.IOException: Cannot run program "/bcsbankms/limitmanager.front/target/node/node" (in directory "/bcsbankms/limitmanager.front/target"): error=2, No such file or directory
Part of the log:
57389 [ERROR] warning "polymer-build > polymer-project-config#3.13.0" has incorrect peer dependency "polymer-analyzer#^3.0.0-pre.17 || ^3.0.0".
59986 [INFO] [4/4] Building fresh packages...
60052 [INFO] success Saved lockfile.
60055 [INFO] Done in 34.04s.
60071 [INFO] Processing frontend files from '/bcsbankms/limitmanager.front/target/frontend'
60086 [INFO] Running 'gulp build_es6' in /bcsbankms/limitmanager.front/target
60091 [INFO] ------------------------------------------------------------------------
60091 [INFO] BUILD FAILURE
60091 [INFO] ------------------------------------------------------------------------
60093 [INFO] Total time: 59.119 s
60093 [INFO] Finished at: 2018-10-05T05:54:08Z
60094 [INFO] ------------------------------------------------------------------------
60094 [ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:11.0.0:package-for-production (default) on project ru.bcs.bank.ms.limitmanager.front: Execution default of goal com.vaadin:vaadin-maven-plugin:11.0.0:package-for-production failed: Transpilation with gulp has failed: 'gulp build_es6' failed. java.io.IOException: Cannot run program "/bcsbankms/limitmanager.front/target/node/node" (in directory "/bcsbankms/limitmanager.front/target"): error=2, No such file or directory -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.vaadin:vaadin-maven-plugin:11.0.0:package-for-production (default) on project ru.bcs.bank.ms.limitmanager.front: Execution default of goal com.vaadin:vaadin-maven-plugin:11.0.0:package-for-production failed: Transpilation with gulp has failed
This is a known issue.
As far as i know, you can ignore it.
I'm trying to deploy a simple JSF app onto a Tomcat 8 server on my local machine. When I run mvn tomcat:deploy, I get the following feedback:
C:\_workspace\portfolio>mvn tomcat:deploy
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.italic:portfolio:war:0.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:tomcat-maven-plugin is missing. # line 38, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Portfolio 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat-maven-plugin:1.1:deploy (default-cli) # portfolio >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # portfolio ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # portfolio ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # portfolio ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # portfolio ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # portfolio ---
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # portfolio ---
[INFO] Packaging webapp
[INFO] Assembling webapp [portfolio] in [C:\_workspace\portfolio\target\portfolio-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\_workspace\portfolio\src\main\webapp]
[INFO] Webapp assembled in [184 msecs]
[INFO] Building war: C:\_workspace\portfolio\target\portfolio-0.0.1-SNAPSHOT.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO]
[INFO] <<< tomcat-maven-plugin:1.1:deploy (default-cli) # portfolio <<<
[INFO]
[INFO] --- tomcat-maven-plugin:1.1:deploy (default-cli) # portfolio ---
[INFO] Deploying war to http://localhost:8080/portfolio
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.499s
[INFO] Finished at: Sat Feb 08 19:10:27 PST 2014
[INFO] Final Memory: 21M/180M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project portfolio: Cannot invoke Tomcat manager: Server returne
d HTTP response code: 405 for URL: http://localhost:8080/manager/text/deploy?path=%2Fportfolio&war= -> [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
C:\_workspace\portfolio>
Apparently Maven is finding the server, but is unable to deploy onto it. I looked around the interwebs and found that this could be due to maven trying to use a "PUT" command. However, after looking at the following answer, I added this code to my tomcat web.xml in the default servlet:
<init-param>
<param-name>readonly</param-name>
<param-value>false</param-value>
</init-param>
However, it doesn't appear to have had any effect. Do you have any further advice on what I can do to get this working?
I'm using Maven 3.1.1 and Tomcat 8.0.1.
It turns out that this was a silly mistake- the user that I had maven using had "manager-gui" privileges instead of "manager-script." Resolving this issue fixed my problem.
Have a local set up using Maven and TestNG which builds just fine. The build is a little odd given that in order for the tests to run, a packaged JAR is needed first. So in effect the local setup runs
#!/bin/bash
mvn clean package -Dmaven.test.skip.exec=true
mvn test
When run on Jenkins, the clean/package step succeeds as does test, except no tests are actually run:
[workspace] $ mvn -f some_sub_directory/pom.xml test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ...-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # project ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /var/lib/jenkins/jobs/...
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # project ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # project ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # project ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # project ---
[INFO] Tests are skipped.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.222s
[INFO] Finished at: Fri Nov 22 18:34:00 UTC 2013
[INFO] Final Memory: 11M/89M
[INFO] ------------------------------------------------------------------------
Finished: SUCCESS
Seems as though the testCompile and test goals in the surefire plugin aren't finding any test classes.
Is there an additional config needed in pom.xml?
The default and recommended path for test classes is {basedir}/src/test/java/.
But you can precise the path in your pom.xml
<build>
<testSourceDirectory>{basedir}/path/to/test/classes</testSourceDirectory>
...
</build>
You need to specify your tests that need to be run. I believe, it looks for tests starting with test*. If you are using a testng xml then you need to set that up. Check this link out for examples on how to specify tests in different ways.
Finally, I found that some dependency of maven-one-plugin don't install properly. but fix them this plugin work.
question fixed :
I am working on convert a maven 1 project to maven 2 project so I just run this command at the folder of the project:
mvn one:convert
then get a error:
[INFO] Internal error in the plugin manager executing goal
'org.apache.maven.plugins:maven-one-plugin:1.2:convert':
Unable to find the mojo 'org.apache.maven.plugins:maven-one-plugin:1.2:convert' in
the plugin 'org.apache.maven.plugins:maven-one-plugin'
org.apache.maven.model.v3_0_0.PatternSet
Anybody know the reason ? Sorry I just so green on maven and the task is urgent...
Try maven-one-plugin:convert
Please take a look at the plugin manual and check if your configuration matches the required configuration.
http://maven.apache.org/plugins/maven-one-plugin/usage.html
The plugin does exist in central repo
Just wondering if you are running this command using maven 1. If so, can you install maven 2/3 and try?
Edit 1:
Downloaded a sample Maven 1 project from here.
Ran mvn convert:one using the latest maven (maven 3).
Worked successfully
D:\work\sample-echo>mvn one:convert
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-one-plugin:1.2:convert (default-cli) # standalone-pom ---
[INFO] Adding report org.apache.maven.plugins:maven-changes-plugin
[INFO] There are 14 plugin relocators available
[INFO] Writing new pom to: D:\work\sample-echo\pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.950s
[INFO] Finished at: Wed Jun 22 15:01:52 IST 2011
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------