I have pack jsp file to war using command "maven compile war:war". When i deploy it on JBoss SA i got view like this:
PK«µgG META-INF/þÊPKPK«µgGMETA-INF/MANIFEST.MFóMÌËLK-.Ñ K-*ÎÌϳR0Ô3àår.JM,IMÑuª XèÄ›˜*hø%&ç¤*8çä%–•kòrñrPK©ÆÐCDPK fµgGWEB-INF/PK1µgGWEB-INF/web.xml•‘QKÃ0…ßÿCÈ{’n}‘’v2Ì'}Ys·f¤iÙÍ–úïÕ©æêë9ß!'çÊYW[r„=šÆåtÂJÀ•6n›Ó§Ç9»¡³âúJX3Õ¶$â³MN+ïÛLˆ)oö[1M’‰x¹_>”ÔŠ‡^¹èGê+±SGÅñàxÙÔ"ZÂa¯Á;‰&Ã>¾lJåûVcä"!>û¯ÒUÂ;Ô”ÓgXßFmqG¿'HãñÄHm°µê•9UCóS)R°ñ1`cYƒ¾—…q:^ùÚJ10þ„G³;lG°6ê`ýØ?ðÐ㪜ã†ÒiOyº^ñPK;¤ÙŸ¯PK«µgG META-INF/þÊPK«µgG©ÆÐCD=META-INF/MANIFEST.MFPK fµgGÂWEB-INF/PK1µgG;¤ÙŸ¯èWEB-INF/web.xmlPKð%
Then same files from eclipse compile fine, but i cant use eclipse at this project. Maven is not adding my manifest.mf, is it my problem?
from maven:
[INFO] WEB-INF\web.xml already added, skipping
Related
I have a Spring Boot project that uses SAP Crystal Reports. CR is not published in Maven Central. I imported all of the CR jar files into my Maven local repository. In my projects the jars have the version appended to the jar file name. For one jar file, this causes a runtime error. How can I have that jar not have the appended Maven version?
if you build from source using Maven then you can override the artifact final name in the POM of this project
<finalName>myJar</finalName>
If you run the mvn install manually then you have control of what you store into the Maven repository
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
This is my workaround hack.
The Jar is question is never directly referenced by my project code, it is a runtime library of the Crystal Reports java runtime. I do not need it in the classpath at build time, just in the deployed file built by maven.
My Spring Boot project is deployed as a WAR file so I need to structure my Eclipse Maven project so that the Jar is placed in WEB-INF/lib as a plain web app resource. I do not specify the jar as a maven dependency.
It's a hack because the jar file IS a dependency and SHOULD be specified as a maven project dependency in the pom.xml.
This solves my immediate problem.
I blame SAP for not considering Maven for their Crystal Reports Java runtime.
When creating a Vaadin app via the simple Maven archetype:
mvn -B archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=8.0.6 -DgroupId=org.test -DartifactId=vaadin-app -Dversion=1.0-SNAPSHOT
…and running via the bundled Jetty servlet container, where is my built web app being stored? Is there a WAR file being generated? If so, where?
I am using Java 8 Update 131 on macOS Sierra 10.12.5 with IntelliJ 2017.1.3.
As far as I know and as the docs suggest, when running mvn jetty:run, no artifact is being built. Instead, using its own internal mechanisms, the maven jetty plugin will (re)load your compiled classes from target\classes
The run goal runs on a webapp that does not have to be built into a WAR. Instead, Jetty deploys the webapp from its sources. It looks for the constituent parts of a webapp in the Maven default project locations, although you can override these in the plugin configuration. For example, by default it looks for:
resources in ${project.basedir}/src/main/webapp
classes in ${project.build.outputDirectory}
web.xml in ${project.basedir}/src/main/webapp/WEB-INF/
The plugin automatically ensures the classes are rebuilt and up-to-date before deployment. If you change the source of a class and your IDE automatically compiles it in the background, the plugin picks up the changed class.
You do not need to assemble the webapp into a WAR, saving time during the development cycle. Once invoked, you can configure the plugin to run continuously, scanning for changes in the project and automatically performing a hot redeploy when necessary. Any changes you make are immediately reflected in the running instance of Jetty, letting you quickly jump from coding to testing, rather than going through the cycle of: code, compile, reassemble, redeploy, test.
... and (may) use the dependencies from the maven repo:
*Note
The classpath of the running Jetty instance and its deployed webapp are managed by Maven, and may not be exactly what you expect. For example: a webapp’s dependent jars might be referenced via the local repository, not the WEB-INF/lib directory.
Some of the above mentioned info can also be observed in the log, when running the plugin (running maven with -X aka debug output on, provides more info):
[INFO] Configuring Jetty for project: vaadin-app
[INFO] webAppSourceDirectory not set. Trying src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = D:\tmp\test\vaadin-app\target\classes
[DEBUG] Starting Jetty Server ...
[INFO] Context path = /
[INFO] Tmp directory = D:\tmp\test\vaadin-app\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides = none
[DEBUG] Adding artifact vaadin-server-8.0.6.jar with scope compile for WEB-INF/lib
[DEBUG] Adding artifact vaadin-sass-compiler-0.9.13.jar with scope compile for WEB-INF/lib
[DEBUG] Adding artifact sac-1.3.jar with scope compile for WEB-INF/lib
[DEBUG] Adding artifact flute-1.3.0.gg2.jar with scope compile for WEB-INF/lib
[DEBUG] Adding artifact vaadin-shared-8.0.6.jar with scope compile for WEB-INF/lib
[DEBUG] Adding artifact jsoup-1.8.3.jar with scope compile for WEB-INF/lib
[DEBUG] Adding artifact gentyref-1.2.0.jar with scope compile for WEB-INF/lib
[DEBUG] Adding artifact vaadin-push-8.0.6.jar with scope compile for WEB-INF/lib
[DEBUG] Adding artifact atmosphere-runtime-2.4.5.vaadin2.jar with scope compile for WEB-INF/lib
[DEBUG] Adding artifact vaadin-slf4j-jdk14-1.6.1.jar with scope compile for WEB-INF/lib
[DEBUG] Adding artifact vaadin-client-compiled-8.0.6.jar with scope compile for WEB-INF/lib
[DEBUG] Adding artifact vaadin-themes-8.0.6.jar with scope compile for WEB-INF/lib
[INFO] web.xml file = null
[INFO] Webapp directory = D:\tmp\test\vaadin-app\src\main\webapp
[INFO] Started Jetty Server
However, if you want to build and deploy a packaged war or an exploded one, you can use the jetty:run-war:
This goal first packages your webapp as a WAR file and then deploys it to Jetty. If you set a non-zero scanInterval, Jetty watches your pom.xml and the WAR file; if either changes, it redeploys the war.
... and/or jetty:run-exploded:
The run-exploded goal first assembles your webapp into an exploded WAR file and then deploys it to Jetty. If you set a non-zero scanInterval, Jetty watches your pom.xml,`WEB-INF/lib, WEB-INF/ and WEB-INF/web.xml for changes and redeploys when necessary.
In target folder after mvn install
After you execute mvn install in Maven, a .war file can be found in the "target" folder.
For example… See this screenshot of a project named TryAgain where the folder target contains the WAR file named tryagain-1.0-SNAPSHOT.war.
The details on the documentation of the Maven War Plugin usage states that:
Invoking
mvn package
or
mvn compile war:war
shall generate the WAR file target/vaadin-app-1.0-SNAPSHOT.war
Additionally linking the vaadin-docs which also state that after executing mvn package
The location of the resulting WAR package should be displayed in the command output.
I have a Project called mainProject and it has a maven dependency of a project called jarProject. The jarProject has a property file which comes as part of the jar. On running the mainProject in my IDE I dont get any issues and it runs fine.
When I deploy this mainProject as a Bundle on JBoss server it gives error as it is not able to find this jarProject property file.
Please suggest what can be done to make the jarProject property file available to the mainProject on deployment.
Alright, this is driving me nuts... I am working on a Maven project and I have 3rd Party JAR dependencies that are giving me compilation errors on IntelliJ but not in STS.
My simplified project structure is like this:
FERPAPortlet
-src
--main
---java
----edu.sandiego.parent
-----FERPAPortlet
---resources
---webapp
----META-INF
----WEB-INF
-----jsp
-----lib <----- 3rd Party JARS are here
-----liferay-display.xml
-----liferay-plugin-package.xml
-----liferay-portlet.xml
-----portlet.xml
-----web.xml
--test
-pom.xml
In SpringSource Tool Suite, if I run compile/package, everything runs fine! In fact, if I run it first in STS and then reopen with IntelliJ, the issue is solved. Nonetheless, I prefer IntelliJ over STS...
A sample error I get would be something like this when I run maven compile:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] C:\Users\rico.r-10\Documents\GitHub\github.sandiego.edu\FERPAPortlet\src\main\java\edu\sandiego\parent\FERPAPortlet.java:[3,35] error: package com.sghe.luminis.core.spring does not exist
However, when I navigate to that line, IntelliJ does not highlight it red as an error and I can actually Ctrl+click and IntelliJ will navigate to the library.
I already added the libraries via
Project Structure > Project Settings > Modules > MyModule > Dependencies tab.
What is STS doing that I'm missing in IntelliJ?
EDIT: Got it working! This is what I did.
I deleted the lib folder with the 3rd Party Jars.
I then manually added those Jar files through the command line, like so:
mvn install:install-file "-Dfile=C:\luminis5libs\luminis-dal.jar" "-DgroupId=com.sghe.luminis" "-DartifactId=luminis-dal" "-Dversion=1.6.0" "-Dpackaging=jar"
Finally, I modified the POM to include those dependencies, like so:
<dependency>
<groupId>com.sghe.luminis</groupId>
<artifactId>luminis-dal</artifactId>
<version>1.6.0</version>
</dependency>
You shouldn't have a lib directory. With maven, all the jars come from your local repository, and are copied into the lib directory under the target (build) directory. Check your maven dependencies, and delete lib and everything under it. Your errors are because intellij doesn't see the jars in your defined path.
Click on Maven Projects at the right border of intellij, after click on the 'Reimport all Maven projects' (the blue circular arrow)
My IDEA project compiles and builds just fine when I compile using IntelliJ.
For some reason, when I deploy to tomcat using an exploded-war, 1 jar I have isn't included in the deployment and my spring app fails to load because it can't find the class.
The jar in question is a locally installed maven dependency i.e. on my laptop
Could this be the reason why it is being skipped by IDEA? It maybe tries to find the jar using maven, but since it is local is can't and skips it?
How can I fix this?
The IDEA project is a maven module and builds fine.
Put that jar into the libs folder of tomcat or embed it into your own jar using maven assembly plugin. https://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html