Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Maven import claims no files to index #405

Closed
godeater opened this issue Jun 23, 2017 · 13 comments
Closed

Maven import claims no files to index #405

godeater opened this issue Jun 23, 2017 · 13 comments
Assignees
Labels

Comments

@godeater
Copy link

I'm trying to trial Sourcetrail on a Maven project we have here, only after I've pointed sourcetrail at the pom.xml - and then hit the "Show source files" button, it displays a window saying "File List - 0 files".

I accept this is almost certainly a user issue - but I'm not sure where I'm going wrong!

@mlangkabel
Copy link
Contributor

Hi @godeater, thanks for reaching out to us! Actually we designed the Maven project setup to be as simple as possible, so there is not much the user can do wrong ;) I'd rather say that it's an issue in Sourcetrail and we would be really happy to fix it! Can you provide some more info on the your Maven project? Are you doing anything unusual?

One thing you could check: execute mvn help:effective-pom. This command should output a huge XML tree to your console. Can you please look for a node called sourceDirectory and tell me the names of all the node's parents? Usually this would be "project->build->sourceDirectory" or "projects->project->build->sourceDirectory"

@egraether egraether added the bug label Jun 23, 2017
@godeater
Copy link
Author

I'm actually pretty new to this project, hence the trial of Sourcetrail on it - to try to get a better understanding of the code, so I've actually no real idea of whether it's been set up in a particularly unusual way.

Running the command you've given doesn't give me an XML file, it gives me a bunch of errors - so it's entirely possible my entire maven install is incorrect. Shall we park this until I can get the XML you've asked for? (and which I theorise might actually fix the entire problem? :) )

@mlangkabel
Copy link
Contributor

Thanks for the quick response! The command I gave you won't generate an XML on our harddisk. It will just write the XML struture as console output. But if that command isn't working in your console the Maven integration of Sourcetrail won't be working either ;)

Parking this issue until your maven install is working correctly sounds good!

@mlangkabel mlangkabel removed the bug label Jun 23, 2017
@godeater
Copy link
Author

Okay - got the maven install working, and have run your command successfully (have also checked, and Sourcetrail is still saying it can't find any files to index.).

The sourceDirectory node says this :

"C:\Users\childba\Projects\Stash_Repos\employer\edt\edt\src\main\java"

which looks correct (but only if Sourcetrail recurses down the file tree in there - as that directory only contains sub-directories, and the actual .java files are several levels further down.
effective_pom.xml.txt

@mlangkabel
Copy link
Contributor

Yes, Sourcetrail will recurse down into subfolders of the source directory.

Thank you for providing the xml file! The pom looks good to me. I think now we should check if Sourcetrail uses the correct install of Maven. Can you please open your Sourcetrail preferences window and check the Maven path specified there? Try to run <mavenpath_from_preferences> help:effective-pom and look out for errors.

@godeater
Copy link
Author

godeater commented Jun 23, 2017

The one in the Sourcetrail preferences is the same one I'm running to generate the xml I've sent you.

Preferences path : C:/Dev/apache-maven-3.3.9/bin/mvn.cmd

Output of "which mvn" in Cygwin window : /cygdrive/c/Dev/apache-maven-3.3.9/bin/mvn

PS - Working day has finished now, so anything else you want me to try will have to wait till Monday - sorry!

@mlangkabel
Copy link
Contributor

Alright, have a nice weekend! Right now it really sounds like a bug to me. I'll reflag this issue.

@mlangkabel mlangkabel self-assigned this Jun 23, 2017
@mlangkabel mlangkabel added the bug label Jun 23, 2017
@mlangkabel
Copy link
Contributor

Back to work! So what Sourcetrail actually does is executing the mvn help:effective-pom command and parsing the output for the source directories. It looks like something goes wrong there but the XML you provided looks fine. So can you please just execute the command in your console, pipe the output to a file and upload that file here? If you don't want to have this file on the public bugtracker you can also send it in via e-mail to:

mlangkabel@coati.io

With that console output I'd be able to debug your issue directly :)

@mlangkabel
Copy link
Contributor

Oh, one other thing: Maybe a stupid question, but does the path "C:\Users\childba\Projects\Stash_Repos\employer\edt\edt\src\main\java" exist on your system?

@godeater
Copy link
Author

Doesn't look like it'll be necessary.
In trying to do what you suggested above, I thought I'd best run the cmd version of maven, rather than under cygwin as I usually do. This yielded the fact that I'd never bothered to set a system wide JAVA_HOME variable - it was only in my cygwin bash init scripts.
When I'd fixed that, I thought I'd just try firing up sourcetrail again one more time - and now it's finding the index files.
So perhaps some sort of warning if Sourcetrail finds JAVA_HOME isn't set? :)

@mlangkabel
Copy link
Contributor

Thanks for the quick reply! Good to hear that everything worked out for you! I think the usage of the JAVA_HOME variable is just something Maven does internally and I don't know if Maven has fallbacks for this case and its actually possible to run Maven without setting the JAVA_HOME variable. So I'm not sure if we should bother every user with that info. I'll investigate if this is necessary.

@mlangkabel
Copy link
Contributor

We fixed this issue with Sourcetrail version 2017.2.5.

As Maven will fail if the JAVA_HOME variable is not set on the system Sourcetrail will check that condition before executing Maven and set the value of this variable automatically (derived from the Java Path specified in the application settings). However Sourcetrail will log in a warning that it was required to use this fallback mechanism.

Moreover Sourcetrail will now display a popup when an issued Maven command fails. This popup will show the Maven error message so that the user becomes aware and may react accordingly.

@rxh1999
Copy link

rxh1999 commented Sep 28, 2021

Oh, one other thing: Maybe a stupid question, but does the path "C:\Users\childba\Projects\Stash_Repos\employer\edt\edt\src\main\java" exist on your system?

hello, i am facing the same issue, and i found there is no src\main\java folder on my system, because there are only sub modules. how can i fix this problem?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants