• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

github java collaboration issue

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone!

I'm starting my path with java and one of my steps is to create project via github as collaboration with someone else. I have created many repositories and tried to do it many ways, however each time when my collabolator is cloning it and try to run it is not possible . When we do it rewers it is the same. It looks like project in IntelliJ is read only without possibility to run it. I suspect it is some dummy issue with java version etc. or access rights but we are prety green in this field and spent lots of time trying to solve it but with no effects. Therefore I hope someone can help us, thank you in advance. I attached screen from IntelliJ below:  

1.jpg
[Thumbnail for 1.jpg]
 
Marshal
Posts: 72416
315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I think this isn't a “beginning” topic; I am moving it to our version control forum.
 
Saloon Keeper
Posts: 12811
278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To me it looks like your .iml file got messed up. Can you show its contents?
 
Sheriff
Posts: 7111
184
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
Welcome again to the Ranch, John Nowak!

Just so you know, at the Coderanch we prefer you post your code as text, not a screen shot.  And be sure to UseCodeTags (that's a link).
 
John Nowak
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Knute Snortum ok I understand, but paradoxically I'm almoust sure it is not a matter of code, becasue I have the same problem regardless what I wrote there.

Here is the list of my actions:
1. github repository creation
2. clone of if on PC
3. new project in IntelliJ - te same name and location
4. create file
5. push it on github
6. give access to my collaborator
7. he clone it on his PC and cannot do anything (on my PC it is working)

what I'm doing wrong?

here is my iml:

 
Knute Snortum
Sheriff
Posts: 7111
184
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
I've got to ask, are you commiting the change before you push to GitHub?
 
John Nowak
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, of course
 
Stephan van Hulst
Saloon Keeper
Posts: 12811
278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your .iml file looks okay. The strange this is that, according to the screenshot you've sent, IDEA is not picking up src/ as a source folder, otherwise com.testgits would have been displayed as a package instead of a folder inside a folder.

Can you go into the project configuration (hit F4 when you're in the project tree), navigate to Modules, select the src/ folder and then unmark and then mark it as a Sources folder?
 
John Nowak
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, I opened project settings and marked src as source folder (it was not marked). Thank you
It change a bit situation but I still canot run main, got another error:

At this point one question is pressing on my mind, how it is possible the settings has been wrong when I just clone it?
2.jpg
[Thumbnail for 2.jpg]
3.jpg
[Thumbnail for 3.jpg]
 
Stephan van Hulst
Saloon Keeper
Posts: 12811
278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you share the repository with us?
 
John Nowak
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here is the link to repository:

https://github.com/radekborowski/Testsaper

or

https://github.com/marcinrazny/Saper_new
 
Stephan van Hulst
Saloon Keeper
Posts: 12811
278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You didn't commit the .idea folder. It contains files that tell IDEA what your project looks like.

How did you open the cloned project in the first place if it didn't contain the necessary project files?

Anyway, you should fix it by using IDEA's "New Project from Existing Sources..." wizard to create the project files while keeping the existing modules and source files. IDEA will also create a .gitignore file in the .idea folder that excludes user-specific project files.
 
Sheriff
Posts: 7950
549
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I appologise, but I didn't read all in detail. Few things.

iml files shouldn't but pushed to a shared repository as these are your local machine specific. So whenever you open/import a project (let's say it pulled from github for this purpose), your IDEA should create iml file once at the start, that's it.

If you pulled the project which contained iml file already in it, and that file was created due to other user, your IDEA tried to parse it and used it instead of creating a new one - meant to be for your environment.

Solution: delete iml file, .idea dir along with all files if these were also published to shared repository.
 
Liutauras Vilda
Sheriff
Posts: 7950
549
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Continue.

If the project in a shared repository isn't complemented with Maven or Gradle (in this context project management tools), it can be imported in multiple ways, as simple set of source files or module, in the case of mentioned project management tools - IDEA would know how to import project and its components (whether as simple dirs/packages with source codes or modules) based on the pom or gradle project descriptor files.
 
Liutauras Vilda
Sheriff
Posts: 7950
549
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To solve the immediate problem you can go to:
File -> Project Structure -> Modules -> and mark the dir where the .java file as "Sources".

Adding image as an extra guide
Screenshot-2020-04-21-at-10.34.29.png
[Thumbnail for Screenshot-2020-04-21-at-10.34.29.png]
 
Stephan van Hulst
Saloon Keeper
Posts: 12811
278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Files should only be ignored if they are generated from other files or if they are specific to the user or environment.

If your project is a Maven project, the *.iml files can be generated from the POM, I believe. In that case, ignoring them is appropriate. If you are NOT using Maven, then the *.iml files are the primary source of the project information, and SHOULD be added to source control.

It appears that John's projects are not using Maven. In that case his team needs to share the project files. A better question though, is why are they not using Maven?
 
Liutauras Vilda
Sheriff
Posts: 7950
549
Mac OS X VI Editor BSD Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:If you are NOT using Maven, then the *.iml files are the primary source of the project information, and SHOULD be added to source control.


One thing, if one uses NetBeans IDE, they are of no use, equally if one uses Eclipse IDE or other IDE.
 
Stephan van Hulst
Saloon Keeper
Posts: 12811
278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
True, but I don't see why that would be a reason not to include the files in source control. For a large project, there are always many files that are not relevant for the development of a particular feature. Many IDEs have the ability to hide files from the project view.

It's much more annoying when users that do use the same IDE don't have the project working consistently.
 
Saloon Keeper
Posts: 23409
159
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't worked with IntelliJ in a while, but as I recall, there were 3 XML files that IntelliJ used for a project. One defined the project, one defined the user's project state and I don't remember what the third one held.

Two of those files were suitable for inclusion in a source code archive (e. g., git). The user project state file is personal to each user and should not be included, as doing a pull of that file would totally scramble what your copy of IntelliJ thought you were doing.

IDEs are very powerful tools, but they carry certain penalties, especially when it comes to building projects and even moreso when different people are trying to do builds when they have different machine setups. That's where the command-line based build systems like Maven, Ant, and Gradle are the better bet. I can create a Maven project, do a "maven clean", zip it up, email it to Ulan Bator, and the recipient needs only 3 things to do a complete re-build: the unzip utility, the JDK, and Maven itself. Everything else is either portable or it's something that Maven can locate and install automatically.

And I mean literally, just those 3 things (well, and an OS to run them on!) That happy person in Outer Mongolia doesn't even need an IDE, much less IntelliJ.

Good IDEs - and IntelliJ is one of them - can interact well with systems like Maven. And Maven reciprocates. You can "Eclipse-ize"" a Maven project just by running the "mvn eclipse:eclipse" goal on a POM. You can do likewise with IntelliJ, and I believe that the goal there is "intellij:intellij". And, incidentally, since the metadata files for IntelliJ and Eclipse are independent of each other, you can make a project that can be edited in either IntelliJ or Eclipse depending on the developer's preference. I've done so, in fact.
 
Stephan van Hulst
Saloon Keeper
Posts: 12811
278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:I haven't worked with IntelliJ in a while, but as I recall, there were 3 XML files that IntelliJ used for a project. One defined the project, one defined the user's project state and I don't remember what the third one held.


Yes, .idea/misc.xml and .idea/modules.xml configure the project. These should be included in source control. .idea/workspace.xml is user-specific and should be ignored.

Each module in the project also contains a moduleName.iml. This file should be included as well.
 
Liutauras Vilda
Sheriff
Posts: 7950
549
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is some ref from jetbrains site: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

I personally never worked on a shared project which wouldn't be set with Maven or Gradle, but is seems some people publish IDEA specific files even in those cases.
 
John Nowak
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Guys  

sorry for late answer, I could not continue my project for few days.

Backing to the topic, it looks delating iml file do the job  

It is my first, very simple project and I'm starting to learn java, therefore it's not Maven project.

once again thank you all for your help


 
The overall mission is to change the world. When you've done that, then you can read this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic