Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6072089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:07:17+00:00 2026-05-23T10:07:17+00:00

I am using Eclipse (Helios), with the m2eclipse plugin. I am working on a

  • 0

I am using Eclipse (Helios), with the “m2eclipse” plugin. I am working on a Maven-based web application project, which I test on a local Tomcat server that is setup inside Eclipse.

Generally, this works more or less great. “m2eclipse” can sometimes be flaky… but for the most part it keeps my POM and my Eclipse project settings in sync, and likewise keeps the deployed code current in Tomcat.

However, recently I’ve added a wrinkle. I have one JavaScript include file that needs to be different when going from the test environment to the real production environment. The differences are too significant to be cleanly handled by Maven filtering and token substitution. What I needed was to keep two separate files in my project, and only deploy the one appropriate for the build profile.

I accomplished this with some “targetPath” trickery in my Maven POM:

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-war-plugin</artifactId>
   <version>2.1.1</version>
   <configuration>
      <webResources>
         <resource>
            <!-- take the stuff from a "prod" or "non-prod" subdirectory and copy it one level up -->
            <directory>src/main/webapp/js/${profile.name}</directory>
            <targetPath>js</targetPath>
         </resource>
         <resource>
            <!-- now don't deploy those profile-specific subdirectories -->
            <directory>src/main/webapp/js</directory>
            <excludes>
               <exclude>prod</exclude>
               <exclude>non-prod</exclude>
            </excludes>
         </resource>
      </webResources>
   </configuration>
</plugin>

This builds a perfect WAR file, which works fine when I deploy it some external Tomcat server. However, the problem is that Eclipse does NOT use that WAR file when running Tomcat inside of Eclipse. Instead, Eclipse works with an exploded version of the application, deployed to a cryptic directory like this:

<workspace>/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/MyApp

… and apparently the app’s files are copied to this location PRIOR TO Maven doing the little trickery shown above. Therefore, when testing locally inside of Eclipse, no JavaScript include is present at all in the expected location.

Is there a way around this problem? Maybe an Eclipse change, or a Maven change, to pull the file from Maven’s “target” directory to Eclipse’s “wtpwebapps” directory? Maybe there’s another approach to solving the profile-specific-include-file issue altogether?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:07:18+00:00Added an answer on May 23, 2026 at 10:07 am

    Starting from eclipse (Helios) 3.6 , the option “Java EE Module Dependencies” is replaced by “Deployment Assembly” option . You can configure which files to be deployed to the tomcat running inside of Eclipse in this “Deployment Assembly” option (Project Properties —> Deployment Assembly )

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.