• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Maven and my struggle for the deploying task

 
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I could define a simple structure
A very simple structure to make maven deploy a jar file:-

project.xml
project.properties.xml
maven.xml
src
java
test
target (generated by maven)

all the phases viz, validate,generate-sources,process-sources,generate-resources,process-resources,complie prepare-package and package

I succeeded upto here ie) getting a jar file but  further deploying  this  simple empty jar file is a very tough for me
please suggest an easy way.
In the event of a favourable example i shall be cheerful
As
CRMK

 
author & internet detective
Posts: 40035
809
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you have a "java" directory loose instead of under src/main?
 
Comal Rajagopalaratnam Muthukumar
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:Why do you have a "java" directory loose instead of under src/main?


Hi

The project structure is defined just like any other Text Matter and not
in its true Maven like pardigam. The POM is obtained by using
the archetype:generate,which obviates the inclusion of java directory
beside main & src Hope this clears your clarity
Thanks
As
CRMK
 
Jeanne Boyarsky
author & internet detective
Posts: 40035
809
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maven expects you to use the standard directory structure. You are going to run into extra troubles by deviating from that.
 
Comal Rajagopalaratnam Muthukumar
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:Maven expects you to use the standard directory structure. You are going to run into extra troubles by deviating from that.




Hi
archtypegenerate -D groupId=
                -D artifactI=
                -D achetypArtifactId=maven -archetype-quikstart
                The project that is produced from the above is totally congruent to the
                simple stucture shown in the text matter above adhering to the standard directory system  
                 Hence my request for Deploy method need not  be hurdle.
                 Thanks
                 As
                 CRMK
 
Jeanne Boyarsky
author & internet detective
Posts: 40035
809
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Comal Rajagopalaratnam Muthukumar wrote:

Jeanne Boyarsky wrote:Maven expects you to use the standard directory structure. You are going to run into extra troubles by deviating from that.




Hi
archtypegenerate -D groupId=
                -D artifactI=
                -D achetypArtifactId=maven -archetype-quikstart
                The project that is produced from the above is totally congruent to the
                simple stucture shown in the text matter above adhering to the standard directory system  
                 Hence my request for Deploy method need not  be hurdle.
                 Thanks
                 As
                 CRMK


And yet you have an obscure problem that nobody has experience with because they are using the standard directory structure. My suggestion is to get it working with the standard directory structure. Group id and artifact id shouldn't be blank either.
 
Comal Rajagopalaratnam Muthukumar
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Comal Rajagopalaratnam Muthukumar wrote:

Jeanne Boyarsky wrote:Maven expects you to use the standard directory structure. You are going to run into extra troubles by deviating from that.




Hi
archtypegenerate -D groupId=
                -D artifactI=
                -D achetypArtifactId=maven -archetype-quikstart
                The project that is produced from the above is totally congruent to the
                simple stucture shown in the text matter above adhering to the standard directory system  
                 Hence my request for Deploy method need not  be hurdle.
                 Thanks
                 As
                 CRMK



Hi
Thanks for the suggestion.However my basic need is always from the begining how to fetch j2ee server for deploying having got a war file at hand since the deploying is always done on server.(client server for example)
Incidentally I already produced a couple of jar and war  files through maven( ref the ant,maven session) though the application server is yet to be made & equipped with for want of details.So in a nut shall i always wanted the deploy method for ( a simple j2ee application)I am sure i am mixing up all without going step by step,
Hope you will be able to show a clear cut example easy enough  to comprehend and become good at it (jar,war files are able to be produced)bt application making is to be started from scratch.
You have already made me cheerful halfway.
Thanks
AS
CRMK

 
Saloon Keeper
Posts: 12154
258
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to tell Maven how to run the application. For a J2EE application, your application server (such as Tomcat) typically provides a plugin that will copy your artifact to the appropriate directory. For a good example, find a Maven archetype that will setup a web application for a specific application server.

Here's an example for Tomcat: https://tomcat.apache.org/maven-plugin-2.2/
 
Comal Rajagopalaratnam Muthukumar
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:You need to tell Maven how to run the application. For a J2EE application, your application server (such as Tomcat) typically provides a plugin that will copy your artifact to the appropriate directory. For a good example, find a Maven archetype that will setup a web application for a specific application server.

Here's an example for Tomcat: https://tomcat.apache.org/maven-plugin-2.2/



Hi
 Excellently maven does everything but at the end it throws a minor snag which I  have shown it along with POM.xml (below)
I used the command

mvn.cmd release:prepare

mvn.cmd -X deploy

so we are almost nearing the successful deploying journey but for your needful correction in my pom.xm as stated by maven error

 

Thanks and Cheers
As
CRMK
   
   
 
Stephan van Hulst
Saloon Keeper
Posts: 12154
258
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "mvn deploy" phase is not related to deploying a web application to a web application container. Deploying an artifact means uploading it to a remote repository.

To deploy your web application, execute the correct goal from the web application container plugin. For Tomcat 6, that's "mvn tomcat6:deploy". For Tomcat 7, the command is "mvn tomcat7:deploy".
 
Comal Rajagopalaratnam Muthukumar
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:The "mvn deploy" phase is not related to deploying a web application to a web application container. Deploying an artifact means uploading it to a remote repository.

To deploy your web application, execute the correct goal from the web application container plugin. For Tomcat 6, that's "mvn tomcat6:deploy". For Tomcat 7, the command is "mvn tomcat7:deploy".




Hi
Your corrective suggestion excellently worked for my web project
especially so ,at the verge of
even deploying it on to project

 My POM.xml is as follows

I used the command  mvn.cmd tomcat7:deploy

But at the last step, an unfortunate thing interfered .
The Error is also shown here for your perusal.
Just  clarify as to how to get Deploying war to http://localhost:8080/artifactid
In the event of 100% success I shall be more joyful

Thanks
As
CRMK




 
Comal Rajagopalaratnam Muthukumar
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:The "mvn deploy" phase is not related to deploying a web application to a web application container. Deploying an artifact means uploading it to a remote repository.

To deploy your web application, execute the correct goal from the web application container plugin. For Tomcat 6, that's "mvn tomcat6:deploy". For Tomcat 7, the command is "mvn tomcat7:deploy".




Hi
Your corrective suggestion excellently worked for my web project
especially so ,at the verge of
even deploying it on to project

 My POM.xml is as follows

I used the command  mvn.cmd tomcat7:deploy

But at the last step, an unfortunate thing interfered .
The Error is also shown here for your perusal.
Just  clarify as to how to get Deploying war to http://localhost:8080/artifactid
In the event of 100% success I shall be more joyful

Thanks
As
CRMK




 
Stephan van Hulst
Saloon Keeper
Posts: 12154
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you have the same plugin declared twice?
 
Comal Rajagopalaratnam Muthukumar
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Why do you have the same plugin declared twice?



Hi
The error remaims same as below inspite of plugin being used once or twice
as follows

********************
ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:
eploy (default-cli) on project artifactid: Cannot invoke Tomcat manager: Connec
ion refused: connect -> [Help 1]
ERROR]
*********************
Please do needfull
Thanks
As
CRMK
 
Stephan van Hulst
Saloon Keeper
Posts: 12154
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't help you without knowing the exact POM that you're using. The last one you showed is wrong because you declared the plugin twice with different configuration.

Regardless, have you used Google to find what could cause such an error to be thrown?
 
Comal Rajagopalaratnam Muthukumar
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:I can't help you without knowing the exact POM that you're using. The last one you showed is wrong because you declared the plugin twice with different configuration.

Regardless, have you used Google to find what could cause such an error to be thrown?



Hi
Look at this amazingly surprising results that was dumped by maven
for the following codes and commands

mvn.cmd package
mvn.cmd tomcat:deploy

You will appreciate for using only tomcat:deployinstead of tomcat7:deploy as per earlier trials(owing to deploying failure)
The main help is derived from eclipse for this success full deploying
So contexually tell me as to why the jar file though created  (as usual)is still not able to execute itself

while the war file was give an addtional .extract folder which is self explanatory.
Thanks
As
CRMK




 
Comal Rajagopalaratnam Muthukumar
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:The "mvn deploy" phase is not related to deploying a web application to a web application container. Deploying an artifact means uploading it to a remote repository.

To deploy your web application, execute the correct goal from the web application container plugin. For Tomcat 6, that's "mvn tomcat6:deploy". For Tomcat 7, the command is "mvn tomcat7:deploy".



Hi

WEBXML-ATTRIBUTE is needing a location

My pom as well as output-results are given below
The commands used are
mvn clean
mvn prepare-package
mvn install
Though the good results were forth coming ,surpringly
the webxml  attriute is in need of the hour for a successful output.
I really do not know where to include this webxml details
since all are already included .(Marked with* mark)
Can you please do corrective help
Thanks
As
CRMK


 
Comal Rajagopalaratnam Muthukumar
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:Maven expects you to use the standard directory structure. You are going to run into extra troubles by deviating from that.




Hi
what is the correct standard directory structure that uses an application program in java that is put in a folder with its class files
Can we make the src file as we need and then prepare the pom according to the src file that is created manually
Please give me simple example
Thanks
As
CRMK
 
It's a beautiful day in this neighborhood - Fred Rogers. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic