aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes maven and publish to server problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "maven and publish to server problem" Watch "maven and publish to server problem" New topic
Author

maven and publish to server problem

misha nesterenko
Greenhorn

Joined: Feb 05, 2011
Posts: 28
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

Joined: May 14, 2008
Posts: 5845
    
    7

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.


JBoss In Action
misha nesterenko
Greenhorn

Joined: Feb 05, 2011
Posts: 28
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

Joined: May 14, 2008
Posts: 5845
    
    7

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

Joined: Feb 05, 2011
Posts: 28
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

Joined: May 14, 2008
Posts: 5845
    
    7

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: maven and publish to server problem