Skip to content

Creating a Spring Starter project in non-default file system location #1025

Closed

Description

@fenjen

Description

When creating a Spring Starter project in a non-default, custom file system location, then Eclipse/STS doesn't create the project correctly.

Steps to Reproduce

  1. New Spring Starter Project
  2. Name: MyProject
  3. Uncheck [x] Use default location and change the path
  4. Set Artifact to artifact.id
  5. Add project to working set: My Working Set
  6. Complete the form
  7. Check the Package Explorer view.

Expected

Other Projects
My Working Set
    - MyProject (open)

Actual

Other Projects
    - artifact.id
My Working Set
    - MyProject (closed)

Additional Information

  • Windows 11
  • Eclipse 2023-03 (4.27.0)
  • STS 4.18
  • There are no new log messages in workspace/.metadata/.log when creating the project
  • "Run as Spring Boot App" on artifact.id seems to work.
  • The closed project MyProject cannot be deleted. It disappears after restarting Eclipse.
  • Creating Spring Starter projects in default location works as expected.
  • Creating a Java or Maven project in non-default locations works as expected.

Workaround

  1. Create Spring Starter Project with [x] use default location checked.
  2. Exit Eclipse.
  3. Move project directory to non-default location on command line.
  4. Delete the project in Eclipse and re-import it using Import - "Existing Projects into Workspace".

Activity

  1. added this to the 4.18.1.RELEASE milestone on Apr 12, 2023
  2. BoykoAlex commented on Apr 12, 2023

    @BoykoAlex
    Contributor

    I cannot reproduce this in Win 10 with STS 4.18.0 :-
    Once a project is created in the non-default location on the file system, did you see the contents of the created folder? Any thing in it? Can you import this folder as "Existing Eclipse Project" or "Existing Maven Project"

    Are you able to create a simple Java project in the non-default location? What about simple project (General -> Project)?

  3. fenjen commented on Apr 13, 2023

    @fenjen
    Author

    @BoykoAlex, thanks for trying to reproduce! I think the answers to your questions are already given in the issue description :)

    Any thing in it?

    Yes, I can even run it.

    Can you import this folder as "Existing Eclipse Project" or "Existing Maven Project"

    That's my workaround. The name of the reimported project remains "artifact.id". In fact, the only difference between the two created projects (default location vs. non-default location) in filesystem is .project:

    -       <name>MyProject</name>
    +       <name>artifact.id</name>

    In Eclipse: If you had selected a working set for the new project, then Eclipse generates a second project, broken and closed, with the correct name in that working set. Eclipse shows in the project properties, the (file system) location of that broken project is empty. If no working set was selected, no such second broken project is created.

    Are you able to create a simple Java project in the non-default location?

    Creating a Java or Maven project in non-default locations works as expected.

  4. BoykoAlex commented on Apr 13, 2023

    @BoykoAlex
    Contributor

    @fenjen I should have paid more attention to the description :-) I was able to reproduce the issue. However, the expected behaviour for the project in non-default location (i.e. not under the workspace root) is going to be:

    Other Projects
    My Working Set
        - artifact.id (open)
    

    (not MyProject)
    This is due to the way m2e works. Project name is always artifact id with the exception of project located under the workspace root when the name of the eclipse project is the name (i.e. label) of the Maven project. Therefore, the fix is let M2E or Buildship create the project and then the resultant project is added to the working set.

  5. BoykoAlex commented on Apr 13, 2023

    @BoykoAlex
    Contributor

    Fixed with 0694331

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

for: eclipsetheme: getting-startedtype: bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions