• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Trying to set up Deploy in Intellij

 
Bartender
Posts: 1674
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a working web app that's creating the WAR file in the maven repository.

But, when I try to deploy, I get the unfriendly message: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]

Things I've tried thus far haven't helped.

I followed the "mykong" tutorial, here: https://www.mkyong.com/maven/how-to-deploy-maven-based-war-file-to-tomcat/

My Intellij pom.xml file has this:


My maven settings.xml file has this:



Can someone please let me know what's missing so I can deploy (basically copy) the built war file to Tomcat using the Maven deploy goal?

Thanks in advance,

- mike
 
Sheriff
Posts: 6042
157
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post your entire pom file?  Thanks.
 
Mike London
Bartender
Posts: 1674
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Knute Snortum wrote:Can you post your entire pom file?  Thanks.



Thanks Kunte. See below.

Can you see why the deploy isn't working?


 
Knute Snortum
Sheriff
Posts: 6042
157
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the command you're running mvn deploy?  I have to ask if this is really what you want to do, since you don't have any deploy information in your pom file.  Do you want to deploy your war file to a remote repository?  Because if you want to add your war file to a local repository, then mvn install is all you need.

Ah, I just saw this comment:

You want to launch Tomcat so that you can type http://localhost:8080/manager/serviceName in the address of a browser, right?  Try this command:

mvn tomcat7:run

or

mvn tomcat7:deploy
 
Mike London
Bartender
Posts: 1674
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Knute Snortum wrote:Is the command you're running mvn deploy?  I have to ask if this is really what you want to do, since you don't have any deploy information in your pom file.  Do you want to deploy your war file to a remote repository?  Because if you want to add your war file to a local repository, then mvn install is all you need.

Ah, I just saw this comment:

You want to launch Tomcat so that you can type http://localhost:8080/manager/serviceName in the address of a browser, right?  Try this command:

mvn tomcat7:run

or

mvn tomcat7:deploy



I'm trying to use the "Deploy" option in Maven in Intellij to simply copy the built WAR file to Tomcat. The Web site I included in my original posting uses the same technique.

Did you browse that site?

Does that help clarify?

Thanks,

- mike
 
Ranch Hand
Posts: 119
Hibernate Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you run maven from Terminal the command is:



But if you want to run from the Maven in IntelliJ IDEA, go to the Plugins section and expand the tomcat7 plugin. You will see the deploy command there (tomcat7:deploy).

The deploy that you run right now is the Deploy task of the Maven life cycle which will deploy the artifact / war file into a maven repository.
 
Mike London
Bartender
Posts: 1674
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Wayan Saryada wrote:If you run maven from Terminal the command is:



But if you want to run from the Maven in IntelliJ IDEA, go to the Plugins section and expand the tomcat7 plugin. You will see the deploy command there (tomcat7:deploy).

The deploy that you run right now is the Deploy task of the Maven life cycle which will deploy the artifact / war file into a maven repository.



Thanks Wayan,

Would you please be a little more specific what I need to do? All the other Maven goals are working fine in Intellij.

Where/how do I "expand the tomcat7 plugin"?

Thanks very much in advance,

- mike
 
Wayan Saryada
Ranch Hand
Posts: 119
Hibernate Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you click the Maven Project tool window on the sidebar you will see something like:

 
Wayan Saryada
Ranch Hand
Posts: 119
Hibernate Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyway, because you are using spring boot for your project why not just use the embedded tomcat and run the project using `mvn spring-boot:run` instead?
 
Mike London
Bartender
Posts: 1674
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Wayan Saryada wrote:Anyway, because you are using spring boot for your project why not just use the embedded tomcat and run the project using `mvn spring-boot:run` instead?



OK, cool. I tried that goal and I think it's close.

However, it's trying to connect to Manager (which I can do in the browser with no problems: http://localhost:8080/manager), but the Tomcat deploy had these errors below. It says it's deploying to the right path.

FWIW, I'm really using Tomcat 8.5, not that that should make any difference, right?

------

[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe (Write failed)

[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project aliasrest: Cannot invoke Tomcat manager: Broken pipe (Write failed) -> [Help 1]


Any idea why this would not work?

Error messages less than helpful.

Thanks,

- mike
 
Knute Snortum
Sheriff
Posts: 6042
157
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think Tomcat 8.5 is backwards compatible with 7.0 or even 8.0.  
 
Wayan Saryada
Ranch Hand
Posts: 119
Hibernate Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to change the tomcat7-maven-plugin configuration to the following:



And make sure that the maven configuration (settings.xml) is copied into the .m2 directory in your home folder.
 
Mike London
Bartender
Posts: 1674
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Knute Snortum wrote:I don't think Tomcat 8.5 is backwards compatible with 7.0 or even 8.0.  



I thought I read that people were successfully using the XML as Wayran shows below.

In any case, it's not working for me at all with Tomcat 8.5. I guess I'll just have to manually copy  the file to Tomcat.

(Still get broken pipe errors)

Thanks for the help,

- mike
 
Wayan Saryada
Ranch Hand
Posts: 119
Hibernate Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Mike London wrote:

Knute Snortum wrote:I don't think Tomcat 8.5 is backwards compatible with 7.0 or even 8.0.  



I thought I read that people were successfully using the XML as Wayran shows below.

In any case, it's not working for me at all with Tomcat 8.5. I guess I'll just have to manually copy  the file to Tomcat.

(Still get broken pipe errors)

Thanks for the help,

- mike



I have just tried it on my machine, and it works. Have you copied the `settings.xml` into your `.m2` folder?
 
Wayan Saryada
Ranch Hand
Posts: 119
Hibernate Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here an example output when running the tomcat7:deploy.



One last thing, if you already have the same application deploy on the tomcat server you need to undeploy it first. If you deploy it again it can give your the connection error.
 
Mike London
Bartender
Posts: 1674
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Wayan Saryada wrote:

Mike London wrote:

Knute Snortum wrote:I don't think Tomcat 8.5 is backwards compatible with 7.0 or even 8.0.  



I thought I read that people were successfully using the XML as Wayran shows below.

In any case, it's not working for me at all with Tomcat 8.5. I guess I'll just have to manually copy  the file to Tomcat.

(Still get broken pipe errors)

Thanks for the help,

- mike



I have just tried it on my machine, and it works. Have you copied the `settings.xml` into your `.m2` folder?



It looks like Intellij is using the maven 3 in a totally different folder.

In that settings.xml file, then, is where I specified the server settings.

Are you sure I still need to copy that same settings file  to .m2?

Thanks,

- mike
 
Mike London
Bartender
Posts: 1674
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Wayan Saryada wrote:Here an example output when running the tomcat7:deploy.



One last thing, if you already have the same application deploy on the tomcat server you need to undeploy it first. If you deploy it again it can give your the connection error.




THANK YOU .... THANK YOU .... THANK YOU!!!

You were right. I needed to first undeploy the project in Tomcat, then it worked!

I should have been using tomcat7:redeploy. That works now too!!!

It's a bit confusing why we have to have the "text" portion of the http://localhost:8080/manager/text.

It's also a bit confusing why the "gear-icon" deploy doesn't do what I thought it did and I instead need to use the drop-down for tomcat7 in the Maven projects area.

But, hey, it works!

HAPPY!!!

Thanks again. You rock!

-- mike


 
Wayan Saryada
Ranch Hand
Posts: 119
Hibernate Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The `/manager/text/` is the URL address for the text interface. In the previous version it was just `/manager`.
 
Mike London
Bartender
Posts: 1674
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Wayan Saryada wrote:The `/manager/text/` is the URL address for the text interface. In the previous version it was just `/manager`.



Thanks again. That helps.

- mike
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!