3434import org .apache .maven .plugins .annotations .Mojo ;
3535import org .apache .maven .plugins .annotations .Parameter ;
3636import org .apache .maven .project .MavenProject ;
37+ import org .apache .maven .settings .Settings ;
3738import org .sonatype .plexus .build .incremental .BuildContext ;
3839
3940import pl .project13 .maven .git .build .BuildServerDataProvider ;
@@ -70,6 +71,12 @@ public class GitCommitIdMojo extends AbstractMojo {
7071 @ Parameter (property = "session" , required = true , readonly = true )
7172 MavenSession session ;
7273
74+ /**
75+ * The Maven settings.
76+ */
77+ @ Parameter (property = "settings" , required = true , readonly = true )
78+ Settings settings ;
79+
7380 /**
7481 * <p>Set this to {@code 'true'} to inject git properties into all reactor projects, not just the current one.</p>
7582 *
@@ -572,7 +579,7 @@ private void loadGitDataWithNativeGit(@Nonnull Properties properties) throws Git
572579 .setUseBranchNameFromBuildEnvironment (useBranchNameFromBuildEnvironment )
573580 .setExcludeProperties (excludeProperties )
574581 .setIncludeOnlyProperties (includeOnlyProperties )
575- .setOffline (offline );
582+ .setOffline (offline || settings . isOffline () );
576583
577584 nativeGitProvider .loadGitData (evaluateOnCommit , properties );
578585 } catch (IOException e ) {
@@ -592,7 +599,7 @@ private void loadGitDataWithJGit(@Nonnull Properties properties) throws GitCommi
592599 .setUseBranchNameFromBuildEnvironment (useBranchNameFromBuildEnvironment )
593600 .setExcludeProperties (excludeProperties )
594601 .setIncludeOnlyProperties (includeOnlyProperties )
595- .setOffline (offline );
602+ .setOffline (offline || settings . isOffline () );
596603
597604 jGitProvider .loadGitData (evaluateOnCommit , properties );
598605 }
0 commit comments