开发者

importing a project from Perforce Eclipse Plugin as Java Project

开发者 https://www.devze.com 2023-02-05 20:39 出处:网络
I am trying import a project from Perforce worksp开发者_开发百科ace in Eclipse. It is importing it (fetching the files into java package hierarchy) but the problem is it is not importing as \"Java pro

I am trying import a project from Perforce worksp开发者_开发百科ace in Eclipse. It is importing it (fetching the files into java package hierarchy) but the problem is it is not importing as "Java project". so i can't edit the "Build path" or there is no classpath or something.

Any idea?


You need to make sure to put Eclipse metadata files into your source control system. All files starting with . in the project root along with entire .settings directory need to get checked in along with your source. If you don't do that, Eclipse will loose all knowledge of the type of projects that it is and how it supposed to be configured.


If your Project in Perforce do not contain files of regular Eclipse java projects you can create another project with Java Nature. Keep Project empty.

File > New > Java Project

It will create for you following files.

.classpath
.project
.settings/org.eclipse.jdt.core.prefs

With this empty project by default your source folder is set to "src". Now you have to copy first two files mentioned above to your Perforce workspace directory. Close and reopen project.

If you still have issues please check file .project. It should contain Nature section.

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>Dev-Project_03_04_2016</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>

Now Check your .classpath File. Since you copied it from blank project it contains something like:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>             
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>     
    <classpathentry kind="output" path="bin"/>
</classpath>

You need to remove this default default "src" folder and add your source folders, of course if you wont do development in eclipse you do not need all this. If you did everything correctly, andded also JUnit Nature you wil get something as follows:

 <?xml version="1.0" encoding="UTF-8"?>
<classpath> 
    <classpathentry kind="src" path="bb/apps/911access-zip/components/911emergencydriver-ejb/src/main/java"/>
    <classpathentry kind="src" path="bb/apps/911access-zip/components/911accessmodel-ejb/src/main/java"/>
    <classpathentry kind="src" path="bb/apps/911access-zip/components/911accessplugin-ejb/src/main/java"/>  
    <classpathentry kind="src" path="bb/apps/911access-zip/src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
    <classpathentry kind="output" path="bin"/>
</classpath>
0

精彩评论

暂无评论...
验证码 换一张
取 消