jeudi 19 avril 2018

how to build,compile and packaging my maven web app using maven standalone app in eclipse?

I am probably new to the maven tool, the doubt is regarding the compiling and building war for the tomcat. so, i have the standalone maven application which has multiple packages with multiple java classes. Below is my POM for the java app :-

<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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>projectCore</groupId> <artifactId>projectCore</artifactId> <version>0.0.1-SNAPSHOT</version> <build> <sourceDirectory>src</sourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> </plugins> </build> <packaging>pom</packaging> // dependencies </project>

Now , i have another maven web application where the the java application classes are referred.

the below is the pom.xml :-

<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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>projectWeb</groupId> <artifactId>projectWeb</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <build> <sourceDirectory>src</sourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.6</version> <configuration> <warSourceDirectory>WebContent</warSourceDirectory> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> </plugins> </build> //dependencies <project>

so whenever i do build of the java application, it deletes the target direct and creates a pom file in .m2 directory , what i do not understand is that how should i use the java standalone app containing classes to be available in web app, and that web app to be finally deployed in apached tomcat 7.

Eclipse : mars2 java version 7

please help me at the earliest as i did not find any effective solution yet.

Aucun commentaire:

Enregistrer un commentaire