Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

maven and publish to server problem

 
misha nesterenko
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I am using Maven2, Eclipse with m2e plugin and Tomcat. How can I configure eclipse to take maven dependencies when deploying to tomcat? I have configured (in project properties) deployment assembly which folders to take for deployment, but when I have to change list of dependencies I have to clean and then package all project again, that is a bit long process. How can I tell eclipse that it has to take all necessary dependencies, so cleaning and subsequent packaging won't be necessary.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a little confused. What do you mean by " take maven dependencies when deploying"?

but when I have to change list of dependencies I have to clean and then package all project again

Yes, if you change dependencies on a project you must clean and rebuild the project. But are you saying that is you change the dependencies for one project then you need to clean and rebuild all projects? This might be necessary is there are interrelationships among the projects.

How can I tell eclipse that it has to take all necessary dependencies

That is what it already does. Or do you mean something else by "necessary dependencies"?

I think that a concrete example of what you are seeing and what you would like to have happen instead would help.
 
misha nesterenko
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for instance I have added one dependency, I want it to appear in WEB-INF/lib without repackaging. I want just this one dependency to be copied to WEB-INF/lib. The same with deleting, if I have deleted one dependency I do not want to clean and then package project again, I want this deleted assembly to disappear from WEB-INF/lib.

It is a bit cumbersome to repackage project (not all projects, just only one) when only one file needs to be copied.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I understand - thank you. How are you deploying the app? Via Eclipse or via a Maven plugin?

BTW, I used to do exactly what you are asking for with an Ant script (at least for adding a JAR) - the <copy> task would copy only the new JARs and leave the rest there. But for Maven I always clean and rebuild.
 
misha nesterenko
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Johnson wrote:Now I understand - thank you. How are you deploying the app? Via Eclipse or via a Maven plugin?

via eclipse
Peter Johnson wrote:
BTW, I used to do exactly what you are asking for with an Ant script (at least for adding a JAR) - the <copy> task would copy only the new JARs and leave the rest there. But for Maven I always clean and rebuild.

heh, but I thought that eclipse has more tight connection between eclipse and maven, i.e. eclipse is deploying webapp, it knows that all dependencies goes to WEB-INF/lib, it asks maven "give me dependencies"; something like that.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think Eclipse is that smart. I know that Maven isn't - if you remove something a do a build (without a clean), old stuff still shows up. But then Ant behaves the same. Which is why I always do a clean and build, that prevents unpleasant surprises when the build machine gets hold of the project and builds the project from scratch.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic