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

Plugin makes build fail in non git project #5

Closed
alcarraz opened this issue Nov 19, 2022 · 1 comment · Fixed by #8
Closed

Plugin makes build fail in non git project #5

alcarraz opened this issue Nov 19, 2022 · 1 comment · Fixed by #8

Comments

@alcarraz
Copy link

The plugin makes the jar task to depend on createGitRevision task, that fails if this is not a git repository, the build even fails after performing a git init with a NoHeadException.

There are many options for this:

  1. Not adding the dependency if the project is not in a git repository, and maybe not creating the task at all.
  2. Letting a project property select if we want to run the task.
  3. Ignore the git exception if a project property is set.
  4. All of the above.

The easier to implement are 2 and 3.

I don't know if there is an easy way of asking jGit about whether the project is in a git repository or not, without using hard coded literals for implementing 1. But also for this we would need to ask git specific questions from the JPOSPlugin class, of course we can relay that to a GitRevisonTask method.

@ar
Copy link
Member

ar commented Nov 20, 2022

Good point and thank you for PR #6

I'd like to explore option 1 in order to avoid having to manually set the ignoreGit property.

If we go with option 2, it's a good opportunity to use plugin properties so that we can configure something like:

jpos {
   ignoreGit = true
}

aVolpe added a commit to aVolpe/jpos-gradle-plugin that referenced this issue Sep 28, 2023
The plugin can now be configured using a 'jpos' directive in the .gradle file:

```groovyjpos {
    target = "devel"
    addGitRevision = true
    addBuildTime = true
    archiveJarName = "${project_name}-${version}.jar"
    archiveWarName = "${project_name}-${version}.war"
    installDir = build/install/${project_name}
    distDir = src/dist
}
```

A non trivial refactor of the plugin was made to ensure that those properties
can be configured and used as described in the README.

This commit also makes this plugin compatible with gradle 8, so it fixes jpos#3

The configurability of git revision data also fixes jpos#5.

And it can be a workaround for jpos#7 using a different distDir.

Signed-off-by: Arturo Volpe <[email protected]>
aVolpe added a commit to aVolpe/jpos-gradle-plugin that referenced this issue Sep 28, 2023
The plugin can now be configured using a 'jpos' directive in the .gradle file:

```groovy
jpos {
    target = "devel"
    addGitRevision = true
    addBuildTime = true
    archiveJarName = "${project_name}-${version}.jar"
    archiveWarName = "${project_name}-${version}.war"
    installDir = build/install/${project_name}
    distDir = src/dist
}
```

A non trivial refactor of the plugin was made to ensure that those properties
can be configured and used as described in the README.

This commit also makes this plugin compatible with gradle 8, so it fixes jpos#3

The configurability of git revision data also fixes jpos#5.

And it can be a workaround for jpos#7 using a different distDir.

Signed-off-by: Arturo Volpe <[email protected]>
@ar ar closed this as completed in #8 Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants