• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

Package errors when pulling/pushing projects to/from Github

 
Ranch Hand
Posts: 53
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Workspace on my work PC where I solve java problems and these are sorted into packages and sub packages. I also push the contents to Github regularly

I am now trying to pull the git repository to my personal PC so I can work on them at the weekend but i get a host or errors and problems.

Here is my Work Directory :



And here is my Laptop Directory after pulling for Github :



I cant understand why some packages appear as 'packages' , others appear as 'package folders' (or source folders) and others don't keep the naming convention (ie Exams/interview_exams)

All the errors I'm getting are due to 'wrong package declarations'. Some of which are solved by making a folder the 'source folder'

I also don't want to make to many changes or when I push from my laptop, and pull to my work pc  - Ill have the same errors all over again.

Heres the Github page : https://github.com/kevinmck91/Hackerrank_Challenges
 
Sheriff
Posts: 7126
185
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With something like this, you need to TellTheDetails (that's a link).

* Did you execute Git from Eclipse or from the command line?
* Post the exact statement or procedure you took to pull from Git
* Post the exact error message
* Are you pulling into an existing repository?
* If you don't have modifications in the local repository, what about removing the local git directory and trying again?  Use git clone https://URL/path/to/your/repo.git
 
Kevin Mckeon
Ranch Hand
Posts: 53
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With something like this, you need to TellTheDetails (that's a link).

Im new enough to git so its hard to know how much info is required

* Did you execute Git from Eclipse or from the command line?

From eclipse - both on the work PC and the Home PC.

* Post the exact statement or procedure you took to pull from Git

When I make a change on the work PC, I open the 'Git stagaing' tab , Stage the changes I want to commit and click 'commit and push'.
When I open the Home PC, I clicked 'Import', 'Import from URI', chose the default options, and the packages and classes appear in my Home PC workspace

* Post the exact error message

I solved the first set of errors by adding in the JRE System Library to the project.

The rest of the errors were all based on package names. errors such as :
The declared package "equal_stacks" does not match the expected package "stacks/equal_stacks"
Hence why I posted the images above. Some packages are laid out in hierarchical order. Others follow convention 'stacks/equal_stacks' and others are named like 'stacks.equal_stacks'

* Are you pulling into an existing repository?

As I am importing the project to my Home PC for the first time, I dont believe I am pulling into an existing repository. (It gives me an option while importing to specify where this new repository will live)

* If you don't have modifications in the local repository, what about removing the local git directory and trying again?  Use git clone https://URL/path/to/your/repo.git

I will try this when I get the chance. I wonder is it possible that the issue is because of the Git Ignore file not committing the Work PC files that the Home PC requires.
 
Knute Snortum
Sheriff
Posts: 7126
185
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kevin Mckeon wrote:Im new enough to git so its hard to know how much info is required


I understand.  I'm just informing you that I needed more details.  Thanks for providing them!

The rest of the errors were all based on package names. errors such as :
The declared package "equal_stacks" does not match the expected package "stacks/equal_stacks"
Hence why I posted the images above. Some packages are laid out in hierarchical order. Others follow convention 'stacks/equal_stacks' and others are named like 'stacks.equal_stacks'


I don't understand.  Your package names have a slash in them?  That's definitely the problem if true.
 
author & internet detective
Posts: 42200
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kevin,
Your .classpath file on the work computer specifies the "source directories". It looks you didn't commit this to the github repo. Which means, you are using the defaults on checkout.
 
Knute Snortum
Sheriff
Posts: 7126
185
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne, is it your experience that .project and .classpath files (or any IDE-specific files) should be included in the git repository?
 
Jeanne Boyarsky
author & internet detective
Posts: 42200
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:Jeanne, is it your experience that .project and .classpath files (or any IDE-specific files) should be included in the git repository?


If using a build tool like Maven or Gradle, I would definitely not include the .project and .classpath file in version control.

If relying on Eclipse for configuration (like this poster is), I would commit them. I would also use Eclipse variables for any hard coded paths so the .project/.classpath files would be generic.

As you might imagine, almost all my projects these days fall into category #1.
 
Kevin Mckeon
Ranch Hand
Posts: 53
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:Kevin,
Your .classpath file on the work computer specifies the "source directories". It looks you didn't commit this to the github repo. Which means, you are using the defaults on checkout.



I didn't realize that this was an issue, I thought the Home PC would generate a new .classpath file when the project was checked out.

Is the solution as simple as editing the '.gitignore' file and removing the line that states '/.classpath' ?

Or is there a separate process using Egit to now include the ./classpath file ?

I used https://www.gitignore.io/ to generate the gitignore and then typed in the '/.classpath' manually.

Jeanne, is it your experience that .project and .classpath files (or any IDE-specific files) should be included in the git repository?



I didnt include .project either. Should I ?
 
Jeanne Boyarsky
author & internet detective
Posts: 42200
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kevin,
Eclipse did generate the .classpath automatically. However, it used the defaults and not the customizations you made.  While you are unlikely to have changed your .project file and .settings, you should put all of none of them in version control.

Yes, you can remove it from .gitignore. I'm not sure if that'll be enough or that will confuse Eclipse because you have some config. So I think you'll have to remove all three from .gitignore

Worst case, you can email the file to yourself (not a good practice when sharing code, but it'll get you to be able to move forward.)
 
Did you ever grow anything in the garden of your mind? - Fred Rogers. Tiny ad:
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic