Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple Maven projects inside one Git repository #8

Closed
koraktor opened this issue Feb 11, 2012 · 16 comments
Closed

Support for multiple Maven projects inside one Git repository #8

koraktor opened this issue Feb 11, 2012 · 16 comments
Assignees
Labels
Milestone

Comments

@koraktor
Copy link
Owner

See comments in #1.

Mavanagaiata should be able to search for the Git repository directory, i.e. .git when it is one (or more) levels above the pom.xml.

@koraktor
Copy link
Owner Author

@ravn The commit above should simplify your use case from #1 a lot – it should now work out of the box. Feel free to test it and give feedback on your experience.

@ravn
Copy link

ravn commented Jun 27, 2012

Thanks. I'll have a look at it next time we start a new project.

@ravn
Copy link

ravn commented Jun 27, 2012

Have you uploaded 0.3.2 to Maven Central with this fix?

@koraktor
Copy link
Owner Author

No sorry, I'll probably release this with an updated JGit dependency soon.

@koraktor
Copy link
Owner Author

Version 0.3.2 was just released. It should be available from Maven Central soon.

@ghost ghost assigned koraktor Jun 28, 2012
@mgladdish
Copy link

I have a project that is laid out in a similar way. I've just tried 0.3.2 and get the following error:

[ERROR] Failed to execute goal com.github.koraktor:mavanagaiata:0.3.2:commit (git-commit) on project webapp: Unable to read Git commit information: Missing unknown 58991d3493d3be040d3d02b8505bcd928f4233fc -> [Help 1]

On directory structure:

/parent
/parent/.git
/parent/subdir/
/parent/subdir/pom.xml

Executing mvn from /parent/subdir/

Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing unknown 58991d3493d3be040d3d02b8505bcd928f4233fc
at org.eclipse.jgit.storage.file.WindowCursor.open(WindowCursor.java:125)
at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:228)
at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:812)
at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:725)
at com.github.koraktor.mavanagaiata.AbstractGitMojo.getHead(AbstractGitMojo.java:137)
at com.github.koraktor.mavanagaiata.GitCommitMojo.execute(GitCommitMojo.java:57)

@koraktor
Copy link
Owner Author

What does git show 58991d3493d3be040d3d02b8505bcd928f4233fc give you when run from /parent/subdir/?

@mgladdish
Copy link

It seems happy enough:

commit 58991d3493d3be040d3d02b8505bcd928f4233fc
Author: Martin Gladdish -redacted-
Date: Thu Jun 28 11:26:10 2012 +0100

-diff contents here-

@koraktor
Copy link
Owner Author

Strange. What happens when you set:

<properties>
    <mavanagaiata.gitDir>/path/to/parent</mavanagaiata.gitDir>
</properties>

@mgladdish
Copy link

No difference. I've tried via the maven tag, the plugin configuration element and by passing -Dmavanagaiata.gitDir=../ into maven's command line. I've even tried each of the two earlier versions of jGit with the plugin, as the error appears to suggest it's JGit's problem rather than the plugin's. All with exactly the same outcome.

I'm running git 1.6.5.7 on OS X 10.6.8 if that helps in the slightest.

@koraktor
Copy link
Owner Author

I guess it's either a (in some way) broken repository or a JGit problem.

What happens when you clone the repo?

Oh, and you might also want to try this:

<properties>
    <mavanagaiata.gitDir>/path/to/parent/.git</mavanagaiata.gitDir>
</properties>

@mgladdish
Copy link

Pointing explicitly to the .git directory fixed it!

Many thanks.

@koraktor
Copy link
Owner Author

Hmm, interesting.

It seems AbstractGitMojo#initRepository isn't 100% water-proof. Or there are additional side effects that may cause JGit to fail. It finds the GIT_DIR, but fails when loading data from it.

I'll definitely try to reproduce this.

@mgladdish
Copy link

Cool. Let me know if you need any more info from me to help.

@koraktor
Copy link
Owner Author

I just pushed b5b2b90 which should fix the problem.

It was indeed a problem caused by JGit, which finds parent/.git in the correct place, but doesn't reset the object directory to parent/.git/objects (it will stay at parent/subdir/objects).

@koraktor
Copy link
Owner Author

koraktor commented Jul 5, 2012

The problem is fixed in 0.3.3 which should be available from Central soon.

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

No branches or pull requests

3 participants