I am trying to deploy and run my webapplication using maven and its tomcat plugin.
I have set it up in project's pom.xml, but when I'm calling it from command line:
mvn tomcat:run
all that I get is:
[root#ovz6022 trunk]# mvn -e tomcat:run
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.gotbrains.breeze:breeze:jar:1.0
[INFO] task-segment: [tomcat:run]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing tomcat:run
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /root/trunk/src/main/resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [tomcat:run {execution: default-cli}]
[INFO] Skipping non-war project
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24 seconds
[INFO] Finished at: Thu Jul 23 14:34:31 MDT 2009
[INFO] Final Memory: 7M/14M
[INFO] ------------------------------------------------------------------------
And that's all. Tomcat hasn't been launched but I don't see any errors here.
Does anybody knows what's happening?
As mentioned before, you should use war packaging. However, if you can't because you're using OSGI or some other reason, you can tell the Tomcat plugin to deploy anyway even if it isn't war packaging by using the ignorePackaging option:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<ignorePackaging>true</ignorePackaging>
The clue is in the line:
[INFO] Skipping non-war project
The tomcat:run goal is intended to work with war projects, I'm guessing yours is a jar project.
You need to change the packaging of your project to war, you may also need to provide some additional configuration for the war to actually do anything.
Note: I'd recommend having a separate war project to your jar projects, then adding the jars as dependencies to the war.
if you're using Roo, and haven't yet invoked the controller command then your configuration is not yet set to generate a WAR file.
Related
I am new to Java. Am currently trying to modify some library code and then use a SNAPSHOT jar of that to use in my current project. In IntelliJ IDEA CE, I used the Maven Projects Tool Window and hit the Lifecyle -> Clean command to attempt to make the Snapshot.
I saw the following output...
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building <NAME> 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # <NAME> ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.219 s
[INFO] Finished at: 2019-03-22T11:36:03-04:00
[INFO] Final Memory: 8M/245M
[INFO] ------------------------------------------------------------------------
Process finished with exit code 0
Two questions:
1) Where is that SNAPSHOT jar located?
2) How do I make a SNAPSHOT jar that includes all dependencies?
EDIT: Resolved. Please see comments.
Install manually jar file into repository.
I want to install this SDK as maven dependency.
https://developer.intuit.com/docs/0100_quickbooks_online/0400_tools/0005_accounting/0200_java/0002_installing_the_java_sdk_for_quickbooks
I tried this:
mvn install:install-file -DgroupId=com.intuit.code.devkit.v3 -DartifactId=ipp-v3-java-devkit -Dversion=2.5.0 -Dpackaging=jar -Dfile=c:\lib\ipp-java-qbapihelper-1.2.1-jar-with-dependencies.jar
But I get
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) # standalone-pom ---
[INFO] Installing c:\lib\ipp-java-qbapihelper-1.2.1-jar-with-dependencies.jar to C:\Users\plamen\.m2\repository\com\intuit\code\devkit\v3\ipp-v3-java-devkit\2.5.0\ipp-v3-java-devkit-2.5.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.631 s
[INFO] Finished at: 2016-09-02T17:04:51+03:00
[INFO] Final Memory: 7M/123M
[INFO] ------------------------------------------------------------------------
When I browse my local repository I can't find any jar file into the directory. Can somebody give some advice how I can fix this?
What I've done in the past to make this work is:
Copy the jar file(s) of interest to a temp folder i.e. project root/tmp
Run the following command (adjusting the parameters accordingly) in the command line from the the project root directory:
mvn install:install-file -Dfile=tmp/<filename>.jar -DgroupId=intuit.code.devkit.v3 -DartifactId=ipp-v3-java-devkit -Dversion=2.5.0 -Dpackaging=jar -DlocalRepositoryPath=<repo path> (i.e. src/dependencies/jars)
After that command you should see a src/dependencies/jars/com/... directory with maven artifacts under it
Add dependency to your pom.xml
<!— <project> is the parent element —>
<repositories>
<repository>
<id>system-jars</id>
<url>file://${basedir}/src/dependencies/jars</url>
</repository>
</repositories>
<!— Add the dependency —>
<dependency>
<groupId>com.intuit.code.devkit.v3</groupId>
<artifactId>ipp-v3-java-devkit</artifactId>
<version>2.5.0</version>
</dependency>
Perform a maven clean and package. Verify the classes are included in the end artifact and then delete the tmp directory once everything is correct.
I have created my own jar file and I included it into my project by running:
mvn install:install-file -Dfile=/Users/vladioffe/git/evappcom/evappcom/evapcom-1.0.jar -DgroupId=com.evapp.code -DartifactId=evappcom -Dversion={1.0} -Dpackaging=jar
The build succeeded - here is the output:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EvApp_Server 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) # EvApp_Server ---
[INFO] Installing /Users/vladioffe/git/evappcom/evappcom/evappcom-1.0.jar to /Users/vladioffe/.m2/repository/com/evapp/code/evappcom/{1.0}/evappcom-{1.0}.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.557s
[INFO] Finished at: Tue Jan 21 14:46:32 IST 2014
[INFO] Final Memory: 3M/81M
[INFO] ------------------------------------------------------------------------
When I have added the dependency to the pom file I encountered an error, here is the dependency:
<dependency>
<groupId>com.evapp.code</groupId>
<artifactId>evappcom</artifactId>
<version>1.0</version>
</dependency>
And the error I see near the <dependency> tag is:
Missing artifact com.evapp.code:evappcom:jar:
1.0
I tried to:
Restart eclipse
Clean project
re-install jar
disable and enable Maven
Update Project
Thanks!
Version is not supposed to be in brackets:
-Dversion={1.0} // it must be -Dversion=1.0
I'm developing a project containing different layers. I'm using Maven, JAX-WS, the Spring framework and Hibernate. I tried to generate the WSDL file using jax ws maven plugin. First I used a JRE 7 but it didn't work. When I used a JDK 1.7 this message appeared:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building BSCSwebservices Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for bsh:bsh:jar:1.2b3 is missing, no dependency information available
[WARNING] The POM for com.sun.xml.stream.buffer:streambuffer:jar:0.4 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.jvnet.staxex:stax-ex:jar:1.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The artifact woodstox:wstx-asl:jar:3.2.0 has been relocated to org.codehaus.woodstox:wstx-asl:jar:3.2.0
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # BSCSwebservices ---
[debug] execute contextualize
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 6 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.1:compile (default-compile) # BSCSwebservices ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # BSCSwebservices ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\sayed\workspace\BSCSwebservices1\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.1:testCompile (default-testCompile) # BSCSwebservices ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # BSCSwebservices ---
[INFO] No tests to run.
[INFO] Surefire report directory: C:\Users\sayed\workspace\BSCSwebservices1\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) # BSCSwebservices ---
[INFO] Packaging webapp
[INFO] Assembling webapp [BSCSwebservices] in [C:\Users\sayed\workspace\BSCSwebservices1\target\BSCSwebservices]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\sayed\workspace\BSCSwebservices1\src\main\webapp]
[INFO] Webapp assembled in [607 msecs]
[INFO] Building war: C:\Users\sayed\workspace\BSCSwebservices1\target\BSCSwebservices.war
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored
(webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true')
[INFO]
[INFO] --- jaxws-maven-plugin:1.11:wsgen (service_BillingAccountRead) # BSCSwebservices ---
[WARNING] The POM for woodstox:wstx-asl:jar:3.2.3 is missing, no dependency information available
warning: The apt tool and its associated API are planned to be
removed in the next major JDK release. These features have been
superseded by javac and the standardized annotation processing API,
javax.annotation.processing and javax.lang.model. Users are
recommended to migrate to the annotation processing features of
javac; see the javac man page for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.635s
[INFO] Finished at: Thu Aug 01 20:38:29 WAT 2013
[INFO] Final Memory: 16M/38M
[INFO] ------------------------------------------------------------------------
this a part of pom.xml
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.11</version>
<executions>
<execution>
<id>service_BillingAccountRead</id>
<phase>package</phase>
<goals>
<goal>wsgen</goal>
</goals>
<configuration>
<sei>com.ws.BillingAccountRead</sei>
<genwsdl>true</genwsdl>
<keep>true</keep>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
</plugin>
</plugins>
The build succeeds, but I don't find the WSDL file? And is that the warnings that have an effect after I completed the other layer?
I added the dependency of all all jars appearing in warnings, but the warnings are still shown.
WSDL's get placed by default in {module_root}\target\generated-sources\wsdl
You REALLY need to start including relevant info in your questions. You haven't even posted the relevant parts of your pom. Have you even told jax-ws to generate a wsdl?
Also, fix the tonne of warnings getting spat out when you run your maven build. That just adds to the mess of info you are posting.
EDIT:
Go look up the documentation. You can explicitly state where the wsdls will end up. All of your questions have had simple answers which you could have found yourself with a minimal amount of effort on your part.
Generally, when you build the project, the WSDL document file and the schema document files are not generated automatically. This files are generated on deploy time by the application server. Internally, the server executes the wsgen tool to generate the files. Next, when you request the WSLD document file (add ?wsdl on service endpoint) the application server on the fly update the service url in the files and serves.
If you want include the generation of this files, you can add in your pom.xml the JAX-WS commons. See an example in this question.
I am a beginner in Java EE 6 and now trying to learn Java EE 6 with help of a book 'Java EE 6 novice to professional'. It is using maven to build a project, but when I tried to compile the downloaded source code of that book without using any IDE it fails and showing some errors as follows
C:\Utilities\Java utilities\Java EE 6 book source programs\Chapter02\src>mvn compile
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugin
s/8/maven-plugins-8.pom
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-parent/5/maven
-parent-5.pom
Downloading: http://repo1.maven.org/maven2/org/apache/apache/3/apache-3.pom
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compil
er-plugin/2.0.2/maven-compiler-plugin-2.0.2.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot execute mojo: resources. It requires a project with an existing po
m.xml, but the build is not using one.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10 seconds
[INFO] Finished at: Sun Jan 16 18:33:38 IST 2011
[INFO] Final Memory: 3M/56M
[INFO] ------------------------------------------------------------------------
C:\Utilities\Java utilities\Java EE 6 book source programs\Chapter02\src>mvn -e comp
ile
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot execute mojo: resources. It requires a project with an existing po
m.xml, but the build is not using one.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Cannot execute mojo: res
ources. It requires a project with an existing pom.xml, but the build is not usi
ng one.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:584)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
fecycle(DefaultLifecycleExecutor.java:500)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:479)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:331)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:292)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:345)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:132)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:290)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot execute mojo:
resources. It requires a project with an existing pom.xml, but the build is not
using one.
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:380)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:559)
... 16 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Sun Jan 16 18:34:13 IST 2011
[INFO] Final Memory: 3M/56M
[INFO] ------------------------------------------------------------------------
As I am not familiar even with j2ee, I couldn't solve it. Can anyone help me???
It seems that you are missing a pom.xml file.
It looks like it is a problem with maven, not java (ee). You have to create a pom.xml file for your project to tell maven which dependencies your program has and how to compile the program. Unfortunately I am not very familiar with maven, but I suggest that you read a maven beginner tutorial.
Not sure if you've fixed the issue. I think you need to run the mvn compile command from here:
C:\Utilities\Java utilities\Java EE 6 book source programs\Chapter02>
that is because this the pom.xml is in this folder.