facebook

J2EE War file export, how to exclude certain files?

  1. MyEclipse IDE
  2.  > 
  3. Feature Requests
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #260937 Reply

    mdmaurer
    Participant

    I am running MyEclipse ver 4.1.1. When I select File | Export | J2EE War file, and proceed to export my web application to a .war file for deployment to Tomcat, it is writing several files to the war that I don’t want it to. For example, all the .scc files that our version control software creates, certain .tld files in the project, some .doc files, etc. I always have to go manually open the war file with WinZip and delete the garbage files out of the archive before deploying it. How can I tell Eclipse to NOT export certain files? I want to be able to say “don’t export any *.doc, *.tld, *.scc”, etc.

    Please email responses.

    Thanks,

    Mike

    #260967 Reply

    Riyad Kalla
    Member

    Mike,
    There currently is no way to filter what MyEclipse deploys. You can work around this problem with a bit of a manual step by writing an Ant script to handle your production deployments, but continue to use MyEclipse to do development deployments.

    Also, deployment exclusion is on our TODO list.

    #261857 Reply

    Please make sure this gets into 5.2 or 6.0. When using maven, it’s impossible to the use the built in webapp hot deployment which makes ME almost useless 🙁

    #261884 Reply

    Riyad Kalla
    Member

    Aaron,
    Can you be more specific as to what the problem is? Why is this useless when using Maven, but usefull when not using Maven? (I’m not hugely versed in Maven, maybe I’m missing some build-path-issue here?)

    #262336 Reply

    Maven automatically collects all the dependencies for you and it knows that some JARs will come from “somewhere else”. junit.jar, for example, is only visible during testing. servlet.jar will be provided by the container, so “maven deploy” won’t install it.

    In the maven eclipse plugin, this is handled with an automatic classpath container which the maven plugin manages for you.

    When I use ME, I have these options to exclude things from being deployed: I can exclude project JARs, JARs from other projects and from a classpath container.

    Now, we have a conflict: servlet.jar is in the maven classpath container but I don’t want it deployed. I cannot remove it from the container or the pure maven build (outside Eclipse on my integration server) will fail. If I disable the whole container, I have to manage the dependencies in two places.

    In the end, I simply cannot deploy using ME because the resulting web app will not work because of classpath issues. When I can’t deploy, I can’t run the webapp from inside ME. When I can’t do this, I can’t use hot replacement and what’s the point of using ME if these three features can’t be used?

    Therefore, I would prefer a solution like in IntelliJ where you can specify the deployment of each single JAR, source folder, included project, etc. The maven plugin could then write an exclude list into your settings file.

    The second problem is that maven expects you to have source, resources (XML config files, properties, …) and web files in three different folders. ME can’t handle this ATM. If my resources are outside the src folder, they are ignored. I couldn’t even make ME accept a second source folder.

    #262357 Reply

    Riyad Kalla
    Member

    Maven automatically collects all the dependencies for you and it knows that some JARs will come from “somewhere else”. junit.jar, for example, is only visible during testing. servlet.jar will be provided by the container, so “maven deploy” won’t install it.

    Gotcha

    Therefore, I would prefer a solution like in IntelliJ where you can specify the deployment of each single JAR, source folder, included project, etc. The maven plugin could then write an exclude list into your settings file.

    This is a great argument for our deployment-filtering controls we were looking at to be on par with our new validation exclusion controls. Basically gives you control over every file in a project to either deploy or not deploy. We didn’t have time to get it into 5.1, but I am going to add your comments to it to see if we can get it into 6.0.

    The second problem is that maven expects you to have source, resources (XML config files, properties, …) and web files in three different folders. ME can’t handle this ATM. If my resources are outside the src folder, they are ignored. I couldn’t even make ME accept a second source folder.

    I *am* farmiliar with this part of Maven layout and it is unfortunate we don’t support it yet. The second source folder shouldn’t be a problem though, what do you mean “couldn’t even make ME accept”… what was happening? Did you accidentally setup separate outputs for each source dir?

    #262446 Reply

    I’ve split my single source folder into two (as maven requests) and added both as Eclipse source folders. Unfortunately, ME ignored all files in the second source folder. Since I had been demoralized by the first issue (classpath), I assumed that this doesn’t work as well. Should it work?

    #262461 Reply

    Riyad Kalla
    Member

    What is in the source folder? These should be java files and properties files… if they are actually JSPs and what not, MyEclipse expects those under your WebRoot, not in a source folder.

    #263285 Reply

    I had Java files and properties in the additional source folders. I’ve tried again and it seems to work now. I’ll keep an eye on it and come back when I notice the problem again.

    #263294 Reply

    Riyad Kalla
    Member

    Strange, yes please keep me posted, this should work as expected.

    #264375 Reply

    James Hurff
    Member

    I’m not sure if this is the right place or if this possibly deserves its own topic. In some of our J2EE applications, we have a “typical” EAR configuration…Consider the following…

    1 Enterprise Application called MyApp.ear

    containing…

    1 MyAppWeb.war
    1 MyAppFirstEJB.jar
    1 MyAppSecondEJB.jar

    I am trying to figure out how to best take advantage of exploded deployments and hot sync without having to have multiple copies of the certain classes in different projects. At this point, we have a project for each module and one for the EAR as well. The scenario that causes me grief is when you have a class (POJO for instance) in MyAppWeb/WebRoot/WEB-INF/classes that is used within MyAppFirstEJB/classes. I have not been able to reference the project MyAppWeb within MyAppFirstEJB in order to make the EJB module aware of the POJO classes within the web module. From a workaround perspective, we’ve created a MyAppCommons project that has all of the Java source code within it, is packaged and deployed via Ant and referenced in the META-INF/MANIFEST.MF file for the J2EE application. This technique obviously causes us to lose the the ability to use the hot sync function (which is a real time saver and awesome)!!! What I’ve done to avoid the “Ant route” is to duplicate the POJO objects in both projects (argh!) … I know its nasty, but I don’t want to have to rebuild the whole archive just to make a basic class or JSP change.

    Am I doing something wrong here? Is there a way to reference the other project’s classes so I can avoid these duplicates???

    Also, in regards to the original context of this issue, I have a JAR (ojdbc14.jar, Oracle client) that I reference in the Java Build Path of MyAppWeb.war as an external JAR…I want to exclude this file from the deployment of the WAR. Is my understanding correct that this will be in the 6.0 release of MyEclipse?

    Thanks in advance.

    #264378 Reply

    Riyad Kalla
    Member

    The normal class-loader order is Web -> (has Access) -> EJB, not the other way around. But normally what we suggest, is if both projects need to share some code, is to make a Java Project that contains this utility code, and then add it to the EAR as a reference, this will be like a library project. Note that the EAR’s deployment settings understands these types of projects and will JAR it and put it in the root of itself during deployment so both projects can find it.

    #274197 Reply

    The “Maven Integration” thread contains a patch which allows to specify for each component of the classpath whether it should be included in the WAR/deployment or not. WTP is going that way and I think MyEclipse should, too. The current “exclude dependent project”, etc. is confusing (I’m reading the explanations for several minutes to figure out what it means — every time I use it!) and too limited. IDEA, on the other hand, just has a flag besides each resource which you can easily toggle. Clean, simple to use and understand.

    #281317 Reply

    I have 2 seperate EJB projects which point to a single dependant java project. Project 1 requires only a select files of dependant project.The same is with project2. Is there a way i can exclude certain files from dependant java project during deployment..? One possible solution is set exclusion filter in dependant java project.But this filter will be applicable to both referring projects which i dont want.

    #281336 Reply

    Riyad Kalla
    Member

    tokrishnakumar,
    There is no way to piecemeal the deployment in that situation. What you like want to do is just make the entire Java Project a dependency of the EAR itself, that will add it to the EJB build paths but deploy it as a JAR of the EAR, not as a piecemeal of the EJB projects themselves.

Viewing 15 posts - 1 through 15 (of 15 total)
Reply To: J2EE War file export, how to exclude certain files?

You must be logged in to post in the forum log in