facebook

Is there a way to move a model package to another project?

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #317695 Reply

    lijamie
    Member

    I created a project with domain, dao, service and controller model package all on the same project. Now, I want to create a new project with domain and dao moved to the new project. Is there a way to do so?

    #317724 Reply

    jkennedy
    Member

    It is possible, here are the general steps.

    Please Verify:
    1. You have a backup of your current project, we will be moving code around and I don’t want you to loose work
    2. You are using the Spring DSL? If not, your steps would be different so please let me.

    Non DSL based Projects:
    If you are not using the DSL, then you would rerun the scaffolding on a new project but only generate the domain and dao layer using the checkboxes to turn certain layers on and off. Then create a dependency between your Projects on the Java build path, then delete the domain and doa packages from the original project, and delete the dao properties and context file etc from the resources directory on the original project.

    DSL Based Projects:
    Create a new Java Project for the Domain and DAO Code
    Right click on the project and choose My Eclipse / Add Spring Runtime Dependencies

    Go back to the Original Project
    Open the Navigator View
    Open the .springDSL folder
    Click on the files (with no visible names) in this folder looking at the bottom of the Eclipse window to see the file name, the first one should be .genspecs
    Open this file with the MyEclipse XML editor
    Hit <ctrl><shift><f> to format the xml to make hand editing easier.
    Locate the line that reads <categoryMappings artifactCategoryId=”domain” project=”${project.name}”
    Change the token from ${project.name} to the actual name of your new Project where you want the Domain and DAO code to be generated to (from step 1)
    Repeat for the dao category mapping
    Save the .genspecs file
    Do a clean build
    verify that the new project now has a generated and resources folder with the doa and domain code and configuration
    Right click on these folders and choose (use as source folders)
    Right click on your original project, go to Java Build Path, and click Projects and add the new Domain/Dao Project as a dependency
    Delete the DAO and Domain packages from your original project
    Open the resources folder on the original project
    Copy the jta.properties file from the original project to the new project
    Remove the other dao context file and properties file from the original projects resources dir

    These are the general steps to get a DSL project reconfigured to split the code into two different projects, and to get the basic classpath and configuration files moved around.

    If you go back to the original project and double click on the Spring DSL node in the Project Explorer and choose the Category mapping tab, you will see that the Domain and DAO categories have been mapped to your new project. The UI does not let you set different projects for different layers here which is why you would need to modify the XML file that backs the DSL manually to get this effect if you didn’t set your projects up this way originally.

    Thanks,
    Jack

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Is there a way to move a model package to another project?

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