david
david

Reputation: 761

project imported to eclipse doesn't show source packages as such

Why would be a reason for a project imported to eclipse to not show the package as such and instead just show the regular folder structure?

my .project file

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>hello-connector</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.m2e.core.maven2Builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.m2e.core.maven2Nature</nature>
    </natures>
</projectDescription>

Upvotes: 0

Views: 4342

Answers (4)

david
david

Reputation: 761

I got the packages to show by doing the following

mvn eclipse:eclipse

and installing the activation jar after following the instructions of a warning

[WARNING] An error occurred during dependency resolution.
    Failed to retrieve javax.activation:activation-1.1-osgi
Caused by: Could not find artifact javax.activation:activation:jar:1.1-osgi in mulesoft-releases (http://repository.mulesoft.org/releases/)

Try downloading the file manually from:
    https://maven-repository.dev.java.net/nonav/repository/javax.activation/jars/activation-1.1.jar

Then, install it using the command:
    mvn install:install-file -DgroupId=javax.activation -DartifactId=activation -Dversion=1.1-osgi -Dpackaging=jar -Dfile=/path/to/file

Oh I also clear the dependencies on the POM file to just this

<repositories>
    <repository>
        <id>mulesoft-releases</id>
        <name>MuleSoft Releases Repository</name>
        <url>http://repository.mulesoft.org/releases/</url>
        <layout>default</layout>
    </repository>
</repositories>

so after all of that I'm not sure what helped.. I do have other errors but at least I can move on. Thanks!

Upvotes: 0

Chris Gerken
Chris Gerken

Reputation: 16392

From the navigator view check the contents of your project's root directory. You should see a .classpath file. If that file is missing then the import didn't work properly (note that two critical project configuration files, .project and .classpath, are sometimes ignored by version control systems and even some file system browsers). If the .classpath is there you'll have to reconfigure the .classpath manually (or check that you're using the package explorer view).

Try changing your .project to look like this:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>hello-connector</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.m2e.core.maven2Builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.m2e.core.maven2Nature</nature>
        <nature>org.eclipse.jdt.core.javaNature</nature>
    </natures>
</projectDescription>

Upvotes: 1

esaj
esaj

Reputation: 16035

From the .project-file I'm assuming this is a Maven-project. Try right-clicking on the project root and select Configure -> Convert to Maven project. After that you may need to right-click the project again and select Maven -> Update project configuration. Hope it helps.

Upvotes: 0

John Smith
John Smith

Reputation: 2332

I'm assuming you are not importing an Eclipse project, but rather something IDE independant.

You need to edit the project settings. In the java built path setting, on the first tab, you have to add the source folders as - well - source folders. ;-)

Upvotes: 3

Related Questions