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

  • Home
  • SEARCH
  • 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 3358786
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:47:38+00:00 2026-05-18T02:47:38+00:00

I’m in the process of looking at taking some examples that are currently in

  • 0

I’m in the process of looking at taking some examples that are currently in one format (NOT Mavenized – actually in ANT form) and trying to find an automated way to munge them into something that Eclipse can comprehend. Though I have several years of Java and other odd languages, doing this in Java sounds like using a sledgehammer to drive a nail.

I’ve been looking into scripting languages such as Ruby, Python, Perl, and so on. I have no experience with any of them, but would be happy to learn.

How can I take an example in one format (directory or directory with files) and restructure it into something approximating an Eclipse project? For example, I’d like to take a tree with the following structure

dir my_example
  - build.xml
  - deployment.xml
  - jboss-esb-unfiltered.xml
  - log4j.xml
  - readme.txt

and convert it to

dir1 my_example_eclipse
  - dir src
    - [empty]
  - dir esbcontent
    - dir META-INF
      - deployment.xml
      - jboss-esb-unfiltered.xml
    - log4j.xml
  - readme.txt

In addition, I need the ability to create certain hidden files that Eclipse needs. One of these is the .project file like this:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>helloworld</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
    <buildCommand>
        <name>org.eclipse.jdt.core.javabuilder</name>
        <arguments>
        </arguments>
    </buildCommand>
    <buildCommand>
        <name>org.eclipse.wst.common.project.facet.core.builder</name>
        <arguments>
        </arguments>
    </buildCommand>
    <buildCommand>
        <name>org.eclipse.wst.validation.validationbuilder</name>
        <arguments>
        </arguments>
    </buildCommand>
</buildSpec>
<natures>
    <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
    <nature>org.eclipse.jdt.core.javanature</nature>
    <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
    <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
</natures>
</projectDescription>

How would I create a text file with one of these scripting languages?

Thanks in advance.

  • 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-18T02:47:39+00:00Added an answer on May 18, 2026 at 2:47 am

    This should do what you need (in Python):

    import os
    import shutil
    
    def maven_to_eclipse(maven_dir, eclipse_dir):
        # assumes mode of maven_dir will be the same as eclipse_dir
        new_mode = os.stat(maven_dir).st_mode
        if os.path.exists(eclipse_dir):
            # if new_dir doesn't exist
            # create it with same permissions as old_dir
            os.mkdirs(eclipse_dir, new_mode)
    
        # create directories under new_dir: src, ebscontent, ebscontent/META-INF
        # use os.path.join to work on multiple os 
        os.mkdir(os.path.join(eclipse_dir, 'src'), new_mode)
        os.mkdir(os.path.join(eclipse_dir, 'ebscontent'), new_mode)
        os.mkdir(os.path.join(eclipse_dir, 'ebscontent', 'META-INF'), new_mode)
    
        # cp old/deployment.xml new/ebsconent/META-INF/deployment.xml
        shutil.copy2(os.path.join(maven_dir, 'deployment.xml'),
            os.path.join(eclipse_dir, 'ebscontent', 'META-INF', 'deployment.xml'))
    
        # cp old/jboss-esb-unfiltered.xml new/ebsconent/META-INF/jboss-esb-unfiltered.xml
        shutil.copy2(os.path.join(maven_dir, 'jboss-esb-unfiltered.xml'),
            os.path.join(eclipse_dir, 'ebscontent', 'META-INF', 'jboss-esb-unfiltered.xml'))
    
        # cp old/log4j.xml new/ebsconent/log4j.xml
        shutil.copy2(os.path.join(maven_dir, 'log4j.xml'),
            os.path.join(eclipse_dir, 'ebscontent', 'log4j.xml'))
    
        # cp old/readme.txt new/readme.txt
        shutil.copy2(os.path.join(maven_dir, 'readme.txt'),
            os.path.join(eclipse_dir, 'readme.txt'))
    
    if __name__ == '__main__':
        base_path = 'C:\\Path\\To\\Maven Dirs'
        maven_dirs = ('my_example', 'another_example', 'third_example')
        for maven_dir in maven_dirs:
            maven_to_eclipse(os.path.join(base_path, maven_dir), 
                os.path.join(base_bath, maven_dir + '_eclipse'))
    

    This should work on multiple OSes. This could have been written shorter, but would be more confusing to a newbie. No attempt is made to catch exceptions. For example, os.mkdirs might fail if the new directory already exists.

    Change base_path and maven_dirs before running.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the

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.