Reputation: 799
I'm trying to automate the creation of an Eclipse Java project.
I need a way to do this using the command line.
I found many articles for this for CDT, but not for the java one.
Is there a way to do that with Java IDE?
Upvotes: 1
Views: 1440
Reputation: 1341
Principles of my solution:
.project
and .classpath
files from existing projectsBelow is only the relevant part/end of the script, where .project
file is created.
Note: I did not need a .classpath
file in my case, thus only importing a Project, not Java Project.
# name: the local Eclipse Folder name I give as script arg
# Create Eclipse .project
projectFile="${name}/.project" ;
# below EOF's content comes from an existing real .project file
echo $( cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>${name}</name>
<comment></comment>
<projects></projects>
<buildSpec></buildSpec>
<natures></natures>
</projectDescription>
EOF
) > ${projectFile};
echo "✓ ${projectFile} created" ;
# Create Eclipse .classpath if needed (in case of Java project, not needed for default Project)
...
After this:
Upvotes: 2