Modified: maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/gpg/AbstractGpgSigner.html ============================================================================== --- maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/gpg/AbstractGpgSigner.html (original) +++ maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/gpg/AbstractGpgSigner.html Tue Sep 24 13:04:55 2024 @@ -54,166 +54,172 @@ <a class="jxr_linenumber" name="L46" href="#L46">46</a> <a class="jxr_linenumber" name="L47" href="#L47">47</a> <strong class="jxr_keyword">protected</strong> String passphrase; <a class="jxr_linenumber" name="L48" href="#L48">48</a> -<a class="jxr_linenumber" name="L49" href="#L49">49</a> <strong class="jxr_keyword">private</strong> File outputDir; +<a class="jxr_linenumber" name="L49" href="#L49">49</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">boolean</strong> terminatePassphrase; <a class="jxr_linenumber" name="L50" href="#L50">50</a> -<a class="jxr_linenumber" name="L51" href="#L51">51</a> <strong class="jxr_keyword">private</strong> File buildDir; +<a class="jxr_linenumber" name="L51" href="#L51">51</a> <strong class="jxr_keyword">private</strong> File outputDir; <a class="jxr_linenumber" name="L52" href="#L52">52</a> -<a class="jxr_linenumber" name="L53" href="#L53">53</a> <strong class="jxr_keyword">private</strong> File baseDir; +<a class="jxr_linenumber" name="L53" href="#L53">53</a> <strong class="jxr_keyword">private</strong> File buildDir; <a class="jxr_linenumber" name="L54" href="#L54">54</a> -<a class="jxr_linenumber" name="L55" href="#L55">55</a> <strong class="jxr_keyword">protected</strong> File homeDir; +<a class="jxr_linenumber" name="L55" href="#L55">55</a> <strong class="jxr_keyword">private</strong> File baseDir; <a class="jxr_linenumber" name="L56" href="#L56">56</a> -<a class="jxr_linenumber" name="L57" href="#L57">57</a> <strong class="jxr_keyword">protected</strong> String secretKeyring; +<a class="jxr_linenumber" name="L57" href="#L57">57</a> <strong class="jxr_keyword">protected</strong> File homeDir; <a class="jxr_linenumber" name="L58" href="#L58">58</a> -<a class="jxr_linenumber" name="L59" href="#L59">59</a> <strong class="jxr_keyword">protected</strong> String publicKeyring; +<a class="jxr_linenumber" name="L59" href="#L59">59</a> <strong class="jxr_keyword">protected</strong> String secretKeyring; <a class="jxr_linenumber" name="L60" href="#L60">60</a> -<a class="jxr_linenumber" name="L61" href="#L61">61</a> <strong class="jxr_keyword">protected</strong> String lockMode; +<a class="jxr_linenumber" name="L61" href="#L61">61</a> <strong class="jxr_keyword">protected</strong> String publicKeyring; <a class="jxr_linenumber" name="L62" href="#L62">62</a> -<a class="jxr_linenumber" name="L63" href="#L63">63</a> <strong class="jxr_keyword">protected</strong> List<String> args; +<a class="jxr_linenumber" name="L63" href="#L63">63</a> <strong class="jxr_keyword">protected</strong> String lockMode; <a class="jxr_linenumber" name="L64" href="#L64">64</a> -<a class="jxr_linenumber" name="L65" href="#L65">65</a> <strong class="jxr_keyword">public</strong> Log getLog() { -<a class="jxr_linenumber" name="L66" href="#L66">66</a> <strong class="jxr_keyword">return</strong> log; -<a class="jxr_linenumber" name="L67" href="#L67">67</a> } -<a class="jxr_linenumber" name="L68" href="#L68">68</a> -<a class="jxr_linenumber" name="L69" href="#L69">69</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setArgs(List<String> args) { -<a class="jxr_linenumber" name="L70" href="#L70">70</a> <strong class="jxr_keyword">this</strong>.args = args; -<a class="jxr_linenumber" name="L71" href="#L71">71</a> } -<a class="jxr_linenumber" name="L72" href="#L72">72</a> -<a class="jxr_linenumber" name="L73" href="#L73">73</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setInteractive(<strong class="jxr_keyword">boolean</strong> b) { -<a class="jxr_linenumber" name="L74" href="#L74">74</a> isInteractive = b; -<a class="jxr_linenumber" name="L75" href="#L75">75</a> } -<a class="jxr_linenumber" name="L76" href="#L76">76</a> -<a class="jxr_linenumber" name="L77" href="#L77">77</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setLockMode(String lockMode) { -<a class="jxr_linenumber" name="L78" href="#L78">78</a> <strong class="jxr_keyword">this</strong>.lockMode = lockMode; -<a class="jxr_linenumber" name="L79" href="#L79">79</a> } -<a class="jxr_linenumber" name="L80" href="#L80">80</a> -<a class="jxr_linenumber" name="L81" href="#L81">81</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setUseAgent(<strong class="jxr_keyword">boolean</strong> b) { -<a class="jxr_linenumber" name="L82" href="#L82">82</a> useAgent = b; -<a class="jxr_linenumber" name="L83" href="#L83">83</a> } -<a class="jxr_linenumber" name="L84" href="#L84">84</a> -<a class="jxr_linenumber" name="L85" href="#L85">85</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setDefaultKeyring(<strong class="jxr_keyword">boolean</strong> enabled) { -<a class="jxr_linenumber" name="L86" href="#L86">86</a> defaultKeyring = enabled; -<a class="jxr_linenumber" name="L87" href="#L87">87</a> } -<a class="jxr_linenumber" name="L88" href="#L88">88</a> -<a class="jxr_linenumber" name="L89" href="#L89">89</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setKeyName(String s) { -<a class="jxr_linenumber" name="L90" href="#L90">90</a> keyname = s; -<a class="jxr_linenumber" name="L91" href="#L91">91</a> } -<a class="jxr_linenumber" name="L92" href="#L92">92</a> -<a class="jxr_linenumber" name="L93" href="#L93">93</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setLog(Log log) { -<a class="jxr_linenumber" name="L94" href="#L94">94</a> <strong class="jxr_keyword">this</strong>.log = log; -<a class="jxr_linenumber" name="L95" href="#L95">95</a> } -<a class="jxr_linenumber" name="L96" href="#L96">96</a> -<a class="jxr_linenumber" name="L97" href="#L97">97</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setPassPhrase(String s) { -<a class="jxr_linenumber" name="L98" href="#L98">98</a> passphrase = s; -<a class="jxr_linenumber" name="L99" href="#L99">99</a> } -<a class="jxr_linenumber" name="L100" href="#L100">100</a> -<a class="jxr_linenumber" name="L101" href="#L101">101</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setOutputDirectory(File out) { -<a class="jxr_linenumber" name="L102" href="#L102">102</a> outputDir = out; -<a class="jxr_linenumber" name="L103" href="#L103">103</a> } -<a class="jxr_linenumber" name="L104" href="#L104">104</a> -<a class="jxr_linenumber" name="L105" href="#L105">105</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setBuildDirectory(File out) { -<a class="jxr_linenumber" name="L106" href="#L106">106</a> buildDir = out; -<a class="jxr_linenumber" name="L107" href="#L107">107</a> } -<a class="jxr_linenumber" name="L108" href="#L108">108</a> -<a class="jxr_linenumber" name="L109" href="#L109">109</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setBaseDirectory(File out) { -<a class="jxr_linenumber" name="L110" href="#L110">110</a> baseDir = out; -<a class="jxr_linenumber" name="L111" href="#L111">111</a> } -<a class="jxr_linenumber" name="L112" href="#L112">112</a> -<a class="jxr_linenumber" name="L113" href="#L113">113</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setHomeDirectory(File homeDirectory) { -<a class="jxr_linenumber" name="L114" href="#L114">114</a> homeDir = homeDirectory; -<a class="jxr_linenumber" name="L115" href="#L115">115</a> } -<a class="jxr_linenumber" name="L116" href="#L116">116</a> -<a class="jxr_linenumber" name="L117" href="#L117">117</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setSecretKeyring(String path) { -<a class="jxr_linenumber" name="L118" href="#L118">118</a> secretKeyring = path; -<a class="jxr_linenumber" name="L119" href="#L119">119</a> } -<a class="jxr_linenumber" name="L120" href="#L120">120</a> -<a class="jxr_linenumber" name="L121" href="#L121">121</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setPublicKeyring(String path) { -<a class="jxr_linenumber" name="L122" href="#L122">122</a> publicKeyring = path; -<a class="jxr_linenumber" name="L123" href="#L123">123</a> } -<a class="jxr_linenumber" name="L124" href="#L124">124</a> -<a class="jxr_linenumber" name="L125" href="#L125">125</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">abstract</strong> String signerName(); +<a class="jxr_linenumber" name="L65" href="#L65">65</a> <strong class="jxr_keyword">protected</strong> List<String> args; +<a class="jxr_linenumber" name="L66" href="#L66">66</a> +<a class="jxr_linenumber" name="L67" href="#L67">67</a> <strong class="jxr_keyword">public</strong> Log getLog() { +<a class="jxr_linenumber" name="L68" href="#L68">68</a> <strong class="jxr_keyword">return</strong> log; +<a class="jxr_linenumber" name="L69" href="#L69">69</a> } +<a class="jxr_linenumber" name="L70" href="#L70">70</a> +<a class="jxr_linenumber" name="L71" href="#L71">71</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setArgs(List<String> args) { +<a class="jxr_linenumber" name="L72" href="#L72">72</a> <strong class="jxr_keyword">this</strong>.args = args; +<a class="jxr_linenumber" name="L73" href="#L73">73</a> } +<a class="jxr_linenumber" name="L74" href="#L74">74</a> +<a class="jxr_linenumber" name="L75" href="#L75">75</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setInteractive(<strong class="jxr_keyword">boolean</strong> b) { +<a class="jxr_linenumber" name="L76" href="#L76">76</a> isInteractive = b; +<a class="jxr_linenumber" name="L77" href="#L77">77</a> } +<a class="jxr_linenumber" name="L78" href="#L78">78</a> +<a class="jxr_linenumber" name="L79" href="#L79">79</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setLockMode(String lockMode) { +<a class="jxr_linenumber" name="L80" href="#L80">80</a> <strong class="jxr_keyword">this</strong>.lockMode = lockMode; +<a class="jxr_linenumber" name="L81" href="#L81">81</a> } +<a class="jxr_linenumber" name="L82" href="#L82">82</a> +<a class="jxr_linenumber" name="L83" href="#L83">83</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setUseAgent(<strong class="jxr_keyword">boolean</strong> b) { +<a class="jxr_linenumber" name="L84" href="#L84">84</a> useAgent = b; +<a class="jxr_linenumber" name="L85" href="#L85">85</a> } +<a class="jxr_linenumber" name="L86" href="#L86">86</a> +<a class="jxr_linenumber" name="L87" href="#L87">87</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setDefaultKeyring(<strong class="jxr_keyword">boolean</strong> enabled) { +<a class="jxr_linenumber" name="L88" href="#L88">88</a> defaultKeyring = enabled; +<a class="jxr_linenumber" name="L89" href="#L89">89</a> } +<a class="jxr_linenumber" name="L90" href="#L90">90</a> +<a class="jxr_linenumber" name="L91" href="#L91">91</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setKeyName(String s) { +<a class="jxr_linenumber" name="L92" href="#L92">92</a> keyname = s; +<a class="jxr_linenumber" name="L93" href="#L93">93</a> } +<a class="jxr_linenumber" name="L94" href="#L94">94</a> +<a class="jxr_linenumber" name="L95" href="#L95">95</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setLog(Log log) { +<a class="jxr_linenumber" name="L96" href="#L96">96</a> <strong class="jxr_keyword">this</strong>.log = log; +<a class="jxr_linenumber" name="L97" href="#L97">97</a> } +<a class="jxr_linenumber" name="L98" href="#L98">98</a> +<a class="jxr_linenumber" name="L99" href="#L99">99</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setPassPhrase(String s) { +<a class="jxr_linenumber" name="L100" href="#L100">100</a> passphrase = s; +<a class="jxr_linenumber" name="L101" href="#L101">101</a> } +<a class="jxr_linenumber" name="L102" href="#L102">102</a> +<a class="jxr_linenumber" name="L103" href="#L103">103</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setTerminatePassphrase(<strong class="jxr_keyword">boolean</strong> b) { +<a class="jxr_linenumber" name="L104" href="#L104">104</a> <strong class="jxr_keyword">this</strong>.terminatePassphrase = b; +<a class="jxr_linenumber" name="L105" href="#L105">105</a> } +<a class="jxr_linenumber" name="L106" href="#L106">106</a> +<a class="jxr_linenumber" name="L107" href="#L107">107</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setOutputDirectory(File out) { +<a class="jxr_linenumber" name="L108" href="#L108">108</a> outputDir = out; +<a class="jxr_linenumber" name="L109" href="#L109">109</a> } +<a class="jxr_linenumber" name="L110" href="#L110">110</a> +<a class="jxr_linenumber" name="L111" href="#L111">111</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setBuildDirectory(File out) { +<a class="jxr_linenumber" name="L112" href="#L112">112</a> buildDir = out; +<a class="jxr_linenumber" name="L113" href="#L113">113</a> } +<a class="jxr_linenumber" name="L114" href="#L114">114</a> +<a class="jxr_linenumber" name="L115" href="#L115">115</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setBaseDirectory(File out) { +<a class="jxr_linenumber" name="L116" href="#L116">116</a> baseDir = out; +<a class="jxr_linenumber" name="L117" href="#L117">117</a> } +<a class="jxr_linenumber" name="L118" href="#L118">118</a> +<a class="jxr_linenumber" name="L119" href="#L119">119</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setHomeDirectory(File homeDirectory) { +<a class="jxr_linenumber" name="L120" href="#L120">120</a> homeDir = homeDirectory; +<a class="jxr_linenumber" name="L121" href="#L121">121</a> } +<a class="jxr_linenumber" name="L122" href="#L122">122</a> +<a class="jxr_linenumber" name="L123" href="#L123">123</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setSecretKeyring(String path) { +<a class="jxr_linenumber" name="L124" href="#L124">124</a> secretKeyring = path; +<a class="jxr_linenumber" name="L125" href="#L125">125</a> } <a class="jxr_linenumber" name="L126" href="#L126">126</a> -<a class="jxr_linenumber" name="L127" href="#L127">127</a> <em class="jxr_javadoccomment">/**</em> -<a class="jxr_linenumber" name="L128" href="#L128">128</a> <em class="jxr_javadoccomment"> * Must be invoked BEFORE signing!</em> -<a class="jxr_linenumber" name="L129" href="#L129">129</a> <em class="jxr_javadoccomment"> *</em> -<a class="jxr_linenumber" name="L130" href="#L130">130</a> <em class="jxr_javadoccomment"> * @since 3.2.0</em> -<a class="jxr_linenumber" name="L131" href="#L131">131</a> <em class="jxr_javadoccomment"> */</em> -<a class="jxr_linenumber" name="L132" href="#L132">132</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> prepare() <strong class="jxr_keyword">throws</strong> MojoFailureException {} -<a class="jxr_linenumber" name="L133" href="#L133">133</a> -<a class="jxr_linenumber" name="L134" href="#L134">134</a> <em class="jxr_javadoccomment">/**</em> -<a class="jxr_linenumber" name="L135" href="#L135">135</a> <em class="jxr_javadoccomment"> * Should return some identification about the used key for logging purposes.</em> -<a class="jxr_linenumber" name="L136" href="#L136">136</a> <em class="jxr_javadoccomment"> * Can be invoked only AFTER {@link #prepare()} was invoked.</em> -<a class="jxr_linenumber" name="L137" href="#L137">137</a> <em class="jxr_javadoccomment"> *</em> -<a class="jxr_linenumber" name="L138" href="#L138">138</a> <em class="jxr_javadoccomment"> * @since 3.2.2</em> -<a class="jxr_linenumber" name="L139" href="#L139">139</a> <em class="jxr_javadoccomment"> */</em> -<a class="jxr_linenumber" name="L140" href="#L140">140</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">abstract</strong> String getKeyInfo(); -<a class="jxr_linenumber" name="L141" href="#L141">141</a> -<a class="jxr_linenumber" name="L142" href="#L142">142</a> <em class="jxr_javadoccomment">/**</em> -<a class="jxr_linenumber" name="L143" href="#L143">143</a> <em class="jxr_javadoccomment"> * Create a detached signature file for the provided file.</em> -<a class="jxr_linenumber" name="L144" href="#L144">144</a> <em class="jxr_javadoccomment"> * Can be invoked only AFTER {@link #prepare()} was invoked.</em> -<a class="jxr_linenumber" name="L145" href="#L145">145</a> <em class="jxr_javadoccomment"> *</em> -<a class="jxr_linenumber" name="L146" href="#L146">146</a> <em class="jxr_javadoccomment"> * @param file The file to sign</em> -<a class="jxr_linenumber" name="L147" href="#L147">147</a> <em class="jxr_javadoccomment"> * @return A reference to the generated signature file</em> -<a class="jxr_linenumber" name="L148" href="#L148">148</a> <em class="jxr_javadoccomment"> * @throws MojoExecutionException if signature generation fails</em> -<a class="jxr_linenumber" name="L149" href="#L149">149</a> <em class="jxr_javadoccomment"> */</em> -<a class="jxr_linenumber" name="L150" href="#L150">150</a> <strong class="jxr_keyword">public</strong> File generateSignatureForArtifact(File file) <strong class="jxr_keyword">throws</strong> MojoExecutionException { -<a class="jxr_linenumber" name="L151" href="#L151">151</a> <em class="jxr_comment">// ----------------------------------------------------------------------------</em> -<a class="jxr_linenumber" name="L152" href="#L152">152</a> <em class="jxr_comment">// Set up the file and directory for the signature file</em> -<a class="jxr_linenumber" name="L153" href="#L153">153</a> <em class="jxr_comment">// ----------------------------------------------------------------------------</em> -<a class="jxr_linenumber" name="L154" href="#L154">154</a> -<a class="jxr_linenumber" name="L155" href="#L155">155</a> File signature = <strong class="jxr_keyword">new</strong> File(file + SIGNATURE_EXTENSION); -<a class="jxr_linenumber" name="L156" href="#L156">156</a> -<a class="jxr_linenumber" name="L157" href="#L157">157</a> <strong class="jxr_keyword">boolean</strong> isInBuildDir = false; -<a class="jxr_linenumber" name="L158" href="#L158">158</a> <strong class="jxr_keyword">if</strong> (buildDir != <strong class="jxr_keyword">null</strong>) { -<a class="jxr_linenumber" name="L159" href="#L159">159</a> File parent = signature.getParentFile(); -<a class="jxr_linenumber" name="L160" href="#L160">160</a> <strong class="jxr_keyword">if</strong> (buildDir.equals(parent)) { -<a class="jxr_linenumber" name="L161" href="#L161">161</a> isInBuildDir = <strong class="jxr_keyword">true</strong>; -<a class="jxr_linenumber" name="L162" href="#L162">162</a> } -<a class="jxr_linenumber" name="L163" href="#L163">163</a> } -<a class="jxr_linenumber" name="L164" href="#L164">164</a> <strong class="jxr_keyword">if</strong> (!isInBuildDir && outputDir != <strong class="jxr_keyword">null</strong>) { -<a class="jxr_linenumber" name="L165" href="#L165">165</a> String fileDirectory = <span class="jxr_string">""</span>; -<a class="jxr_linenumber" name="L166" href="#L166">166</a> File signatureDirectory = signature; -<a class="jxr_linenumber" name="L167" href="#L167">167</a> -<a class="jxr_linenumber" name="L168" href="#L168">168</a> <strong class="jxr_keyword">while</strong> ((signatureDirectory = signatureDirectory.getParentFile()) != <strong class="jxr_keyword">null</strong>) { -<a class="jxr_linenumber" name="L169" href="#L169">169</a> <strong class="jxr_keyword">if</strong> (isPossibleRootOfArtifact(signatureDirectory)) { -<a class="jxr_linenumber" name="L170" href="#L170">170</a> <strong class="jxr_keyword">break</strong>; -<a class="jxr_linenumber" name="L171" href="#L171">171</a> } -<a class="jxr_linenumber" name="L172" href="#L172">172</a> fileDirectory = signatureDirectory.getName() + File.separatorChar + fileDirectory; -<a class="jxr_linenumber" name="L173" href="#L173">173</a> } -<a class="jxr_linenumber" name="L174" href="#L174">174</a> signatureDirectory = <strong class="jxr_keyword">new</strong> File(outputDir, fileDirectory); -<a class="jxr_linenumber" name="L175" href="#L175">175</a> <strong class="jxr_keyword">if</strong> (!signatureDirectory.exists()) { -<a class="jxr_linenumber" name="L176" href="#L176">176</a> signatureDirectory.mkdirs(); -<a class="jxr_linenumber" name="L177" href="#L177">177</a> } -<a class="jxr_linenumber" name="L178" href="#L178">178</a> signature = <strong class="jxr_keyword">new</strong> File(signatureDirectory, file.getName() + SIGNATURE_EXTENSION); -<a class="jxr_linenumber" name="L179" href="#L179">179</a> } -<a class="jxr_linenumber" name="L180" href="#L180">180</a> -<a class="jxr_linenumber" name="L181" href="#L181">181</a> <strong class="jxr_keyword">if</strong> (signature.exists()) { -<a class="jxr_linenumber" name="L182" href="#L182">182</a> signature.delete(); -<a class="jxr_linenumber" name="L183" href="#L183">183</a> } -<a class="jxr_linenumber" name="L184" href="#L184">184</a> -<a class="jxr_linenumber" name="L185" href="#L185">185</a> <em class="jxr_comment">// ----------------------------------------------------------------------------</em> -<a class="jxr_linenumber" name="L186" href="#L186">186</a> <em class="jxr_comment">// Generate the signature file</em> -<a class="jxr_linenumber" name="L187" href="#L187">187</a> <em class="jxr_comment">// ----------------------------------------------------------------------------</em> -<a class="jxr_linenumber" name="L188" href="#L188">188</a> -<a class="jxr_linenumber" name="L189" href="#L189">189</a> generateSignatureForFile(file, signature); +<a class="jxr_linenumber" name="L127" href="#L127">127</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setPublicKeyring(String path) { +<a class="jxr_linenumber" name="L128" href="#L128">128</a> publicKeyring = path; +<a class="jxr_linenumber" name="L129" href="#L129">129</a> } +<a class="jxr_linenumber" name="L130" href="#L130">130</a> +<a class="jxr_linenumber" name="L131" href="#L131">131</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">abstract</strong> String signerName(); +<a class="jxr_linenumber" name="L132" href="#L132">132</a> +<a class="jxr_linenumber" name="L133" href="#L133">133</a> <em class="jxr_javadoccomment">/**</em> +<a class="jxr_linenumber" name="L134" href="#L134">134</a> <em class="jxr_javadoccomment"> * Must be invoked BEFORE signing!</em> +<a class="jxr_linenumber" name="L135" href="#L135">135</a> <em class="jxr_javadoccomment"> *</em> +<a class="jxr_linenumber" name="L136" href="#L136">136</a> <em class="jxr_javadoccomment"> * @since 3.2.0</em> +<a class="jxr_linenumber" name="L137" href="#L137">137</a> <em class="jxr_javadoccomment"> */</em> +<a class="jxr_linenumber" name="L138" href="#L138">138</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> prepare() <strong class="jxr_keyword">throws</strong> MojoFailureException {} +<a class="jxr_linenumber" name="L139" href="#L139">139</a> +<a class="jxr_linenumber" name="L140" href="#L140">140</a> <em class="jxr_javadoccomment">/**</em> +<a class="jxr_linenumber" name="L141" href="#L141">141</a> <em class="jxr_javadoccomment"> * Should return some identification about the used key for logging purposes.</em> +<a class="jxr_linenumber" name="L142" href="#L142">142</a> <em class="jxr_javadoccomment"> * Can be invoked only AFTER {@link #prepare()} was invoked.</em> +<a class="jxr_linenumber" name="L143" href="#L143">143</a> <em class="jxr_javadoccomment"> *</em> +<a class="jxr_linenumber" name="L144" href="#L144">144</a> <em class="jxr_javadoccomment"> * @since 3.2.2</em> +<a class="jxr_linenumber" name="L145" href="#L145">145</a> <em class="jxr_javadoccomment"> */</em> +<a class="jxr_linenumber" name="L146" href="#L146">146</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">abstract</strong> String getKeyInfo(); +<a class="jxr_linenumber" name="L147" href="#L147">147</a> +<a class="jxr_linenumber" name="L148" href="#L148">148</a> <em class="jxr_javadoccomment">/**</em> +<a class="jxr_linenumber" name="L149" href="#L149">149</a> <em class="jxr_javadoccomment"> * Create a detached signature file for the provided file.</em> +<a class="jxr_linenumber" name="L150" href="#L150">150</a> <em class="jxr_javadoccomment"> * Can be invoked only AFTER {@link #prepare()} was invoked.</em> +<a class="jxr_linenumber" name="L151" href="#L151">151</a> <em class="jxr_javadoccomment"> *</em> +<a class="jxr_linenumber" name="L152" href="#L152">152</a> <em class="jxr_javadoccomment"> * @param file The file to sign</em> +<a class="jxr_linenumber" name="L153" href="#L153">153</a> <em class="jxr_javadoccomment"> * @return A reference to the generated signature file</em> +<a class="jxr_linenumber" name="L154" href="#L154">154</a> <em class="jxr_javadoccomment"> * @throws MojoExecutionException if signature generation fails</em> +<a class="jxr_linenumber" name="L155" href="#L155">155</a> <em class="jxr_javadoccomment"> */</em> +<a class="jxr_linenumber" name="L156" href="#L156">156</a> <strong class="jxr_keyword">public</strong> File generateSignatureForArtifact(File file) <strong class="jxr_keyword">throws</strong> MojoExecutionException { +<a class="jxr_linenumber" name="L157" href="#L157">157</a> <em class="jxr_comment">// ----------------------------------------------------------------------------</em> +<a class="jxr_linenumber" name="L158" href="#L158">158</a> <em class="jxr_comment">// Set up the file and directory for the signature file</em> +<a class="jxr_linenumber" name="L159" href="#L159">159</a> <em class="jxr_comment">// ----------------------------------------------------------------------------</em> +<a class="jxr_linenumber" name="L160" href="#L160">160</a> +<a class="jxr_linenumber" name="L161" href="#L161">161</a> File signature = <strong class="jxr_keyword">new</strong> File(file + SIGNATURE_EXTENSION); +<a class="jxr_linenumber" name="L162" href="#L162">162</a> +<a class="jxr_linenumber" name="L163" href="#L163">163</a> <strong class="jxr_keyword">boolean</strong> isInBuildDir = false; +<a class="jxr_linenumber" name="L164" href="#L164">164</a> <strong class="jxr_keyword">if</strong> (buildDir != <strong class="jxr_keyword">null</strong>) { +<a class="jxr_linenumber" name="L165" href="#L165">165</a> File parent = signature.getParentFile(); +<a class="jxr_linenumber" name="L166" href="#L166">166</a> <strong class="jxr_keyword">if</strong> (buildDir.equals(parent)) { +<a class="jxr_linenumber" name="L167" href="#L167">167</a> isInBuildDir = <strong class="jxr_keyword">true</strong>; +<a class="jxr_linenumber" name="L168" href="#L168">168</a> } +<a class="jxr_linenumber" name="L169" href="#L169">169</a> } +<a class="jxr_linenumber" name="L170" href="#L170">170</a> <strong class="jxr_keyword">if</strong> (!isInBuildDir && outputDir != <strong class="jxr_keyword">null</strong>) { +<a class="jxr_linenumber" name="L171" href="#L171">171</a> String fileDirectory = <span class="jxr_string">""</span>; +<a class="jxr_linenumber" name="L172" href="#L172">172</a> File signatureDirectory = signature; +<a class="jxr_linenumber" name="L173" href="#L173">173</a> +<a class="jxr_linenumber" name="L174" href="#L174">174</a> <strong class="jxr_keyword">while</strong> ((signatureDirectory = signatureDirectory.getParentFile()) != <strong class="jxr_keyword">null</strong>) { +<a class="jxr_linenumber" name="L175" href="#L175">175</a> <strong class="jxr_keyword">if</strong> (isPossibleRootOfArtifact(signatureDirectory)) { +<a class="jxr_linenumber" name="L176" href="#L176">176</a> <strong class="jxr_keyword">break</strong>; +<a class="jxr_linenumber" name="L177" href="#L177">177</a> } +<a class="jxr_linenumber" name="L178" href="#L178">178</a> fileDirectory = signatureDirectory.getName() + File.separatorChar + fileDirectory; +<a class="jxr_linenumber" name="L179" href="#L179">179</a> } +<a class="jxr_linenumber" name="L180" href="#L180">180</a> signatureDirectory = <strong class="jxr_keyword">new</strong> File(outputDir, fileDirectory); +<a class="jxr_linenumber" name="L181" href="#L181">181</a> <strong class="jxr_keyword">if</strong> (!signatureDirectory.exists()) { +<a class="jxr_linenumber" name="L182" href="#L182">182</a> signatureDirectory.mkdirs(); +<a class="jxr_linenumber" name="L183" href="#L183">183</a> } +<a class="jxr_linenumber" name="L184" href="#L184">184</a> signature = <strong class="jxr_keyword">new</strong> File(signatureDirectory, file.getName() + SIGNATURE_EXTENSION); +<a class="jxr_linenumber" name="L185" href="#L185">185</a> } +<a class="jxr_linenumber" name="L186" href="#L186">186</a> +<a class="jxr_linenumber" name="L187" href="#L187">187</a> <strong class="jxr_keyword">if</strong> (signature.exists()) { +<a class="jxr_linenumber" name="L188" href="#L188">188</a> signature.delete(); +<a class="jxr_linenumber" name="L189" href="#L189">189</a> } <a class="jxr_linenumber" name="L190" href="#L190">190</a> -<a class="jxr_linenumber" name="L191" href="#L191">191</a> <strong class="jxr_keyword">return</strong> signature; -<a class="jxr_linenumber" name="L192" href="#L192">192</a> } -<a class="jxr_linenumber" name="L193" href="#L193">193</a> -<a class="jxr_linenumber" name="L194" href="#L194">194</a> <em class="jxr_javadoccomment">/**</em> -<a class="jxr_linenumber" name="L195" href="#L195">195</a> <em class="jxr_javadoccomment"> * Generate the detached signature file for the provided file.</em> -<a class="jxr_linenumber" name="L196" href="#L196">196</a> <em class="jxr_javadoccomment"> *</em> -<a class="jxr_linenumber" name="L197" href="#L197">197</a> <em class="jxr_javadoccomment"> * @param file The file to sign</em> -<a class="jxr_linenumber" name="L198" href="#L198">198</a> <em class="jxr_javadoccomment"> * @param signature The file in which the generate signature will be put</em> -<a class="jxr_linenumber" name="L199" href="#L199">199</a> <em class="jxr_javadoccomment"> * @throws MojoExecutionException if signature generation fails</em> -<a class="jxr_linenumber" name="L200" href="#L200">200</a> <em class="jxr_javadoccomment"> */</em> -<a class="jxr_linenumber" name="L201" href="#L201">201</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">abstract</strong> <strong class="jxr_keyword">void</strong> generateSignatureForFile(File file, File signature) <strong class="jxr_keyword">throws</strong> MojoExecutionException; -<a class="jxr_linenumber" name="L202" href="#L202">202</a> -<a class="jxr_linenumber" name="L203" href="#L203">203</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> isPossibleRootOfArtifact(File signatureDirectory) { -<a class="jxr_linenumber" name="L204" href="#L204">204</a> <strong class="jxr_keyword">return</strong> signatureDirectory.equals(outputDir) -<a class="jxr_linenumber" name="L205" href="#L205">205</a> || signatureDirectory.equals(buildDir) -<a class="jxr_linenumber" name="L206" href="#L206">206</a> || signatureDirectory.equals(baseDir); -<a class="jxr_linenumber" name="L207" href="#L207">207</a> } -<a class="jxr_linenumber" name="L208" href="#L208">208</a> } +<a class="jxr_linenumber" name="L191" href="#L191">191</a> <em class="jxr_comment">// ----------------------------------------------------------------------------</em> +<a class="jxr_linenumber" name="L192" href="#L192">192</a> <em class="jxr_comment">// Generate the signature file</em> +<a class="jxr_linenumber" name="L193" href="#L193">193</a> <em class="jxr_comment">// ----------------------------------------------------------------------------</em> +<a class="jxr_linenumber" name="L194" href="#L194">194</a> +<a class="jxr_linenumber" name="L195" href="#L195">195</a> generateSignatureForFile(file, signature); +<a class="jxr_linenumber" name="L196" href="#L196">196</a> +<a class="jxr_linenumber" name="L197" href="#L197">197</a> <strong class="jxr_keyword">return</strong> signature; +<a class="jxr_linenumber" name="L198" href="#L198">198</a> } +<a class="jxr_linenumber" name="L199" href="#L199">199</a> +<a class="jxr_linenumber" name="L200" href="#L200">200</a> <em class="jxr_javadoccomment">/**</em> +<a class="jxr_linenumber" name="L201" href="#L201">201</a> <em class="jxr_javadoccomment"> * Generate the detached signature file for the provided file.</em> +<a class="jxr_linenumber" name="L202" href="#L202">202</a> <em class="jxr_javadoccomment"> *</em> +<a class="jxr_linenumber" name="L203" href="#L203">203</a> <em class="jxr_javadoccomment"> * @param file The file to sign</em> +<a class="jxr_linenumber" name="L204" href="#L204">204</a> <em class="jxr_javadoccomment"> * @param signature The file in which the generate signature will be put</em> +<a class="jxr_linenumber" name="L205" href="#L205">205</a> <em class="jxr_javadoccomment"> * @throws MojoExecutionException if signature generation fails</em> +<a class="jxr_linenumber" name="L206" href="#L206">206</a> <em class="jxr_javadoccomment"> */</em> +<a class="jxr_linenumber" name="L207" href="#L207">207</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">abstract</strong> <strong class="jxr_keyword">void</strong> generateSignatureForFile(File file, File signature) <strong class="jxr_keyword">throws</strong> MojoExecutionException; +<a class="jxr_linenumber" name="L208" href="#L208">208</a> +<a class="jxr_linenumber" name="L209" href="#L209">209</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> isPossibleRootOfArtifact(File signatureDirectory) { +<a class="jxr_linenumber" name="L210" href="#L210">210</a> <strong class="jxr_keyword">return</strong> signatureDirectory.equals(outputDir) +<a class="jxr_linenumber" name="L211" href="#L211">211</a> || signatureDirectory.equals(buildDir) +<a class="jxr_linenumber" name="L212" href="#L212">212</a> || signatureDirectory.equals(baseDir); +<a class="jxr_linenumber" name="L213" href="#L213">213</a> } +<a class="jxr_linenumber" name="L214" href="#L214">214</a> } </pre> <hr/> <div id="footer">Copyright © 2002–2024 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</div>
Modified: maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/gpg/GpgSigner.html ============================================================================== --- maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/gpg/GpgSigner.html (original) +++ maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/gpg/GpgSigner.html Tue Sep 24 13:04:55 2024 @@ -120,90 +120,91 @@ <a class="jxr_linenumber" name="L112" href="#L112">112</a> cmd.createArg().setValue(<span class="jxr_string">"--passphrase-fd"</span>); <a class="jxr_linenumber" name="L113" href="#L113">113</a> cmd.createArg().setValue(<span class="jxr_string">"0"</span>); <a class="jxr_linenumber" name="L114" href="#L114">114</a> -<a class="jxr_linenumber" name="L115" href="#L115">115</a> <em class="jxr_comment">// Prepare the input stream which will be used to pass the passphrase to the executable</em> -<a class="jxr_linenumber" name="L116" href="#L116">116</a> <strong class="jxr_keyword">if</strong> (!passphrase.endsWith(System.lineSeparator())) { -<a class="jxr_linenumber" name="L117" href="#L117">117</a> in = <strong class="jxr_keyword">new</strong> ByteArrayInputStream((passphrase + System.lineSeparator()).getBytes()); -<a class="jxr_linenumber" name="L118" href="#L118">118</a> } <strong class="jxr_keyword">else</strong> { -<a class="jxr_linenumber" name="L119" href="#L119">119</a> in = <strong class="jxr_keyword">new</strong> ByteArrayInputStream(passphrase.getBytes()); -<a class="jxr_linenumber" name="L120" href="#L120">120</a> } -<a class="jxr_linenumber" name="L121" href="#L121">121</a> } -<a class="jxr_linenumber" name="L122" href="#L122">122</a> -<a class="jxr_linenumber" name="L123" href="#L123">123</a> <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> != keyname) { -<a class="jxr_linenumber" name="L124" href="#L124">124</a> cmd.createArg().setValue(<span class="jxr_string">"--local-user"</span>); -<a class="jxr_linenumber" name="L125" href="#L125">125</a> -<a class="jxr_linenumber" name="L126" href="#L126">126</a> cmd.createArg().setValue(keyname); -<a class="jxr_linenumber" name="L127" href="#L127">127</a> } -<a class="jxr_linenumber" name="L128" href="#L128">128</a> -<a class="jxr_linenumber" name="L129" href="#L129">129</a> cmd.createArg().setValue(<span class="jxr_string">"--armor"</span>); -<a class="jxr_linenumber" name="L130" href="#L130">130</a> -<a class="jxr_linenumber" name="L131" href="#L131">131</a> cmd.createArg().setValue(<span class="jxr_string">"--detach-sign"</span>); -<a class="jxr_linenumber" name="L132" href="#L132">132</a> -<a class="jxr_linenumber" name="L133" href="#L133">133</a> <strong class="jxr_keyword">if</strong> (getLog().isDebugEnabled()) { -<a class="jxr_linenumber" name="L134" href="#L134">134</a> <em class="jxr_comment">// instruct GPG to write status information to stdout</em> -<a class="jxr_linenumber" name="L135" href="#L135">135</a> cmd.createArg().setValue(<span class="jxr_string">"--status-fd"</span>); -<a class="jxr_linenumber" name="L136" href="#L136">136</a> cmd.createArg().setValue(<span class="jxr_string">"1"</span>); -<a class="jxr_linenumber" name="L137" href="#L137">137</a> } -<a class="jxr_linenumber" name="L138" href="#L138">138</a> -<a class="jxr_linenumber" name="L139" href="#L139">139</a> <strong class="jxr_keyword">if</strong> (!isInteractive) { -<a class="jxr_linenumber" name="L140" href="#L140">140</a> cmd.createArg().setValue(<span class="jxr_string">"--batch"</span>); -<a class="jxr_linenumber" name="L141" href="#L141">141</a> cmd.createArg().setValue(<span class="jxr_string">"--no-tty"</span>); -<a class="jxr_linenumber" name="L142" href="#L142">142</a> -<a class="jxr_linenumber" name="L143" href="#L143">143</a> <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> == passphrase && gpgVersion.isAtLeast(GpgVersion.parse(<span class="jxr_string">"2.1"</span>))) { -<a class="jxr_linenumber" name="L144" href="#L144">144</a> <em class="jxr_comment">// prevent GPG from spawning input prompts in Maven non-interactive mode</em> -<a class="jxr_linenumber" name="L145" href="#L145">145</a> cmd.createArg().setValue(<span class="jxr_string">"--pinentry-mode"</span>); -<a class="jxr_linenumber" name="L146" href="#L146">146</a> cmd.createArg().setValue(<span class="jxr_string">"error"</span>); -<a class="jxr_linenumber" name="L147" href="#L147">147</a> } -<a class="jxr_linenumber" name="L148" href="#L148">148</a> } -<a class="jxr_linenumber" name="L149" href="#L149">149</a> -<a class="jxr_linenumber" name="L150" href="#L150">150</a> <strong class="jxr_keyword">if</strong> (!defaultKeyring) { -<a class="jxr_linenumber" name="L151" href="#L151">151</a> cmd.createArg().setValue(<span class="jxr_string">"--no-default-keyring"</span>); -<a class="jxr_linenumber" name="L152" href="#L152">152</a> } -<a class="jxr_linenumber" name="L153" href="#L153">153</a> -<a class="jxr_linenumber" name="L154" href="#L154">154</a> <strong class="jxr_keyword">if</strong> (secretKeyring != <strong class="jxr_keyword">null</strong> && !secretKeyring.isEmpty()) { -<a class="jxr_linenumber" name="L155" href="#L155">155</a> <strong class="jxr_keyword">if</strong> (gpgVersion.isBefore(GpgVersion.parse(<span class="jxr_string">"2.1"</span>))) { -<a class="jxr_linenumber" name="L156" href="#L156">156</a> cmd.createArg().setValue(<span class="jxr_string">"--secret-keyring"</span>); -<a class="jxr_linenumber" name="L157" href="#L157">157</a> cmd.createArg().setValue(secretKeyring); -<a class="jxr_linenumber" name="L158" href="#L158">158</a> } <strong class="jxr_keyword">else</strong> { -<a class="jxr_linenumber" name="L159" href="#L159">159</a> getLog().warn(<span class="jxr_string">"'secretKeyring' is an obsolete option and ignored. All secret keys "</span> -<a class="jxr_linenumber" name="L160" href="#L160">160</a> + <span class="jxr_string">"are stored in the âprivate-keys-v1.dâ directory below the GnuPG home directory."</span>); -<a class="jxr_linenumber" name="L161" href="#L161">161</a> } -<a class="jxr_linenumber" name="L162" href="#L162">162</a> } -<a class="jxr_linenumber" name="L163" href="#L163">163</a> -<a class="jxr_linenumber" name="L164" href="#L164">164</a> <strong class="jxr_keyword">if</strong> (publicKeyring != <strong class="jxr_keyword">null</strong> && !publicKeyring.isEmpty()) { -<a class="jxr_linenumber" name="L165" href="#L165">165</a> cmd.createArg().setValue(<span class="jxr_string">"--keyring"</span>); -<a class="jxr_linenumber" name="L166" href="#L166">166</a> cmd.createArg().setValue(publicKeyring); -<a class="jxr_linenumber" name="L167" href="#L167">167</a> } -<a class="jxr_linenumber" name="L168" href="#L168">168</a> -<a class="jxr_linenumber" name="L169" href="#L169">169</a> <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"once"</span>.equalsIgnoreCase(lockMode)) { -<a class="jxr_linenumber" name="L170" href="#L170">170</a> cmd.createArg().setValue(<span class="jxr_string">"--lock-once"</span>); -<a class="jxr_linenumber" name="L171" href="#L171">171</a> } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"multiple"</span>.equalsIgnoreCase(lockMode)) { -<a class="jxr_linenumber" name="L172" href="#L172">172</a> cmd.createArg().setValue(<span class="jxr_string">"--lock-multiple"</span>); -<a class="jxr_linenumber" name="L173" href="#L173">173</a> } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"never"</span>.equalsIgnoreCase(lockMode)) { -<a class="jxr_linenumber" name="L174" href="#L174">174</a> cmd.createArg().setValue(<span class="jxr_string">"--lock-never"</span>); -<a class="jxr_linenumber" name="L175" href="#L175">175</a> } -<a class="jxr_linenumber" name="L176" href="#L176">176</a> -<a class="jxr_linenumber" name="L177" href="#L177">177</a> cmd.createArg().setValue(<span class="jxr_string">"--output"</span>); -<a class="jxr_linenumber" name="L178" href="#L178">178</a> cmd.createArg().setFile(signature); -<a class="jxr_linenumber" name="L179" href="#L179">179</a> -<a class="jxr_linenumber" name="L180" href="#L180">180</a> cmd.createArg().setFile(file); -<a class="jxr_linenumber" name="L181" href="#L181">181</a> -<a class="jxr_linenumber" name="L182" href="#L182">182</a> <em class="jxr_comment">// ----------------------------------------------------------------------------</em> -<a class="jxr_linenumber" name="L183" href="#L183">183</a> <em class="jxr_comment">// Execute the command line</em> -<a class="jxr_linenumber" name="L184" href="#L184">184</a> <em class="jxr_comment">// ----------------------------------------------------------------------------</em> -<a class="jxr_linenumber" name="L185" href="#L185">185</a> -<a class="jxr_linenumber" name="L186" href="#L186">186</a> getLog().debug(<span class="jxr_string">"CMD: "</span> + cmd); -<a class="jxr_linenumber" name="L187" href="#L187">187</a> -<a class="jxr_linenumber" name="L188" href="#L188">188</a> <strong class="jxr_keyword">try</strong> { -<a class="jxr_linenumber" name="L189" href="#L189">189</a> <strong class="jxr_keyword">int</strong> exitCode = CommandLineUtils.executeCommandLine(cmd, in, <strong class="jxr_keyword">new</strong> DefaultConsumer(), <strong class="jxr_keyword">new</strong> DefaultConsumer()); -<a class="jxr_linenumber" name="L190" href="#L190">190</a> -<a class="jxr_linenumber" name="L191" href="#L191">191</a> <strong class="jxr_keyword">if</strong> (exitCode != 0) { -<a class="jxr_linenumber" name="L192" href="#L192">192</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> MojoExecutionException(<span class="jxr_string">"Exit code: "</span> + exitCode); -<a class="jxr_linenumber" name="L193" href="#L193">193</a> } -<a class="jxr_linenumber" name="L194" href="#L194">194</a> } <strong class="jxr_keyword">catch</strong> (CommandLineException e) { -<a class="jxr_linenumber" name="L195" href="#L195">195</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> MojoExecutionException(<span class="jxr_string">"Unable to execute gpg command"</span>, e); -<a class="jxr_linenumber" name="L196" href="#L196">196</a> } -<a class="jxr_linenumber" name="L197" href="#L197">197</a> } -<a class="jxr_linenumber" name="L198" href="#L198">198</a> } +<a class="jxr_linenumber" name="L115" href="#L115">115</a> <em class="jxr_comment">// Prepare the STDIN stream which will be used to pass the passphrase to the executable</em> +<a class="jxr_linenumber" name="L116" href="#L116">116</a> <em class="jxr_comment">// but obey terminatePassphrase: append LF if asked for</em> +<a class="jxr_linenumber" name="L117" href="#L117">117</a> <strong class="jxr_keyword">if</strong> (terminatePassphrase && !passphrase.endsWith(<span class="jxr_string">"\n"</span>)) { +<a class="jxr_linenumber" name="L118" href="#L118">118</a> in = <strong class="jxr_keyword">new</strong> ByteArrayInputStream((passphrase + <span class="jxr_string">"\n"</span>).getBytes()); +<a class="jxr_linenumber" name="L119" href="#L119">119</a> } <strong class="jxr_keyword">else</strong> { +<a class="jxr_linenumber" name="L120" href="#L120">120</a> in = <strong class="jxr_keyword">new</strong> ByteArrayInputStream(passphrase.getBytes()); +<a class="jxr_linenumber" name="L121" href="#L121">121</a> } +<a class="jxr_linenumber" name="L122" href="#L122">122</a> } +<a class="jxr_linenumber" name="L123" href="#L123">123</a> +<a class="jxr_linenumber" name="L124" href="#L124">124</a> <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> != keyname) { +<a class="jxr_linenumber" name="L125" href="#L125">125</a> cmd.createArg().setValue(<span class="jxr_string">"--local-user"</span>); +<a class="jxr_linenumber" name="L126" href="#L126">126</a> +<a class="jxr_linenumber" name="L127" href="#L127">127</a> cmd.createArg().setValue(keyname); +<a class="jxr_linenumber" name="L128" href="#L128">128</a> } +<a class="jxr_linenumber" name="L129" href="#L129">129</a> +<a class="jxr_linenumber" name="L130" href="#L130">130</a> cmd.createArg().setValue(<span class="jxr_string">"--armor"</span>); +<a class="jxr_linenumber" name="L131" href="#L131">131</a> +<a class="jxr_linenumber" name="L132" href="#L132">132</a> cmd.createArg().setValue(<span class="jxr_string">"--detach-sign"</span>); +<a class="jxr_linenumber" name="L133" href="#L133">133</a> +<a class="jxr_linenumber" name="L134" href="#L134">134</a> <strong class="jxr_keyword">if</strong> (getLog().isDebugEnabled()) { +<a class="jxr_linenumber" name="L135" href="#L135">135</a> <em class="jxr_comment">// instruct GPG to write status information to stdout</em> +<a class="jxr_linenumber" name="L136" href="#L136">136</a> cmd.createArg().setValue(<span class="jxr_string">"--status-fd"</span>); +<a class="jxr_linenumber" name="L137" href="#L137">137</a> cmd.createArg().setValue(<span class="jxr_string">"1"</span>); +<a class="jxr_linenumber" name="L138" href="#L138">138</a> } +<a class="jxr_linenumber" name="L139" href="#L139">139</a> +<a class="jxr_linenumber" name="L140" href="#L140">140</a> <strong class="jxr_keyword">if</strong> (!isInteractive) { +<a class="jxr_linenumber" name="L141" href="#L141">141</a> cmd.createArg().setValue(<span class="jxr_string">"--batch"</span>); +<a class="jxr_linenumber" name="L142" href="#L142">142</a> cmd.createArg().setValue(<span class="jxr_string">"--no-tty"</span>); +<a class="jxr_linenumber" name="L143" href="#L143">143</a> +<a class="jxr_linenumber" name="L144" href="#L144">144</a> <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> == passphrase && gpgVersion.isAtLeast(GpgVersion.parse(<span class="jxr_string">"2.1"</span>))) { +<a class="jxr_linenumber" name="L145" href="#L145">145</a> <em class="jxr_comment">// prevent GPG from spawning input prompts in Maven non-interactive mode</em> +<a class="jxr_linenumber" name="L146" href="#L146">146</a> cmd.createArg().setValue(<span class="jxr_string">"--pinentry-mode"</span>); +<a class="jxr_linenumber" name="L147" href="#L147">147</a> cmd.createArg().setValue(<span class="jxr_string">"error"</span>); +<a class="jxr_linenumber" name="L148" href="#L148">148</a> } +<a class="jxr_linenumber" name="L149" href="#L149">149</a> } +<a class="jxr_linenumber" name="L150" href="#L150">150</a> +<a class="jxr_linenumber" name="L151" href="#L151">151</a> <strong class="jxr_keyword">if</strong> (!defaultKeyring) { +<a class="jxr_linenumber" name="L152" href="#L152">152</a> cmd.createArg().setValue(<span class="jxr_string">"--no-default-keyring"</span>); +<a class="jxr_linenumber" name="L153" href="#L153">153</a> } +<a class="jxr_linenumber" name="L154" href="#L154">154</a> +<a class="jxr_linenumber" name="L155" href="#L155">155</a> <strong class="jxr_keyword">if</strong> (secretKeyring != <strong class="jxr_keyword">null</strong> && !secretKeyring.isEmpty()) { +<a class="jxr_linenumber" name="L156" href="#L156">156</a> <strong class="jxr_keyword">if</strong> (gpgVersion.isBefore(GpgVersion.parse(<span class="jxr_string">"2.1"</span>))) { +<a class="jxr_linenumber" name="L157" href="#L157">157</a> cmd.createArg().setValue(<span class="jxr_string">"--secret-keyring"</span>); +<a class="jxr_linenumber" name="L158" href="#L158">158</a> cmd.createArg().setValue(secretKeyring); +<a class="jxr_linenumber" name="L159" href="#L159">159</a> } <strong class="jxr_keyword">else</strong> { +<a class="jxr_linenumber" name="L160" href="#L160">160</a> getLog().warn(<span class="jxr_string">"'secretKeyring' is an obsolete option and ignored. All secret keys "</span> +<a class="jxr_linenumber" name="L161" href="#L161">161</a> + <span class="jxr_string">"are stored in the âprivate-keys-v1.dâ directory below the GnuPG home directory."</span>); +<a class="jxr_linenumber" name="L162" href="#L162">162</a> } +<a class="jxr_linenumber" name="L163" href="#L163">163</a> } +<a class="jxr_linenumber" name="L164" href="#L164">164</a> +<a class="jxr_linenumber" name="L165" href="#L165">165</a> <strong class="jxr_keyword">if</strong> (publicKeyring != <strong class="jxr_keyword">null</strong> && !publicKeyring.isEmpty()) { +<a class="jxr_linenumber" name="L166" href="#L166">166</a> cmd.createArg().setValue(<span class="jxr_string">"--keyring"</span>); +<a class="jxr_linenumber" name="L167" href="#L167">167</a> cmd.createArg().setValue(publicKeyring); +<a class="jxr_linenumber" name="L168" href="#L168">168</a> } +<a class="jxr_linenumber" name="L169" href="#L169">169</a> +<a class="jxr_linenumber" name="L170" href="#L170">170</a> <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"once"</span>.equalsIgnoreCase(lockMode)) { +<a class="jxr_linenumber" name="L171" href="#L171">171</a> cmd.createArg().setValue(<span class="jxr_string">"--lock-once"</span>); +<a class="jxr_linenumber" name="L172" href="#L172">172</a> } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"multiple"</span>.equalsIgnoreCase(lockMode)) { +<a class="jxr_linenumber" name="L173" href="#L173">173</a> cmd.createArg().setValue(<span class="jxr_string">"--lock-multiple"</span>); +<a class="jxr_linenumber" name="L174" href="#L174">174</a> } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"never"</span>.equalsIgnoreCase(lockMode)) { +<a class="jxr_linenumber" name="L175" href="#L175">175</a> cmd.createArg().setValue(<span class="jxr_string">"--lock-never"</span>); +<a class="jxr_linenumber" name="L176" href="#L176">176</a> } +<a class="jxr_linenumber" name="L177" href="#L177">177</a> +<a class="jxr_linenumber" name="L178" href="#L178">178</a> cmd.createArg().setValue(<span class="jxr_string">"--output"</span>); +<a class="jxr_linenumber" name="L179" href="#L179">179</a> cmd.createArg().setFile(signature); +<a class="jxr_linenumber" name="L180" href="#L180">180</a> +<a class="jxr_linenumber" name="L181" href="#L181">181</a> cmd.createArg().setFile(file); +<a class="jxr_linenumber" name="L182" href="#L182">182</a> +<a class="jxr_linenumber" name="L183" href="#L183">183</a> <em class="jxr_comment">// ----------------------------------------------------------------------------</em> +<a class="jxr_linenumber" name="L184" href="#L184">184</a> <em class="jxr_comment">// Execute the command line</em> +<a class="jxr_linenumber" name="L185" href="#L185">185</a> <em class="jxr_comment">// ----------------------------------------------------------------------------</em> +<a class="jxr_linenumber" name="L186" href="#L186">186</a> +<a class="jxr_linenumber" name="L187" href="#L187">187</a> getLog().debug(<span class="jxr_string">"CMD: "</span> + cmd); +<a class="jxr_linenumber" name="L188" href="#L188">188</a> +<a class="jxr_linenumber" name="L189" href="#L189">189</a> <strong class="jxr_keyword">try</strong> { +<a class="jxr_linenumber" name="L190" href="#L190">190</a> <strong class="jxr_keyword">int</strong> exitCode = CommandLineUtils.executeCommandLine(cmd, in, <strong class="jxr_keyword">new</strong> DefaultConsumer(), <strong class="jxr_keyword">new</strong> DefaultConsumer()); +<a class="jxr_linenumber" name="L191" href="#L191">191</a> +<a class="jxr_linenumber" name="L192" href="#L192">192</a> <strong class="jxr_keyword">if</strong> (exitCode != 0) { +<a class="jxr_linenumber" name="L193" href="#L193">193</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> MojoExecutionException(<span class="jxr_string">"Exit code: "</span> + exitCode); +<a class="jxr_linenumber" name="L194" href="#L194">194</a> } +<a class="jxr_linenumber" name="L195" href="#L195">195</a> } <strong class="jxr_keyword">catch</strong> (CommandLineException e) { +<a class="jxr_linenumber" name="L196" href="#L196">196</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> MojoExecutionException(<span class="jxr_string">"Unable to execute gpg command"</span>, e); +<a class="jxr_linenumber" name="L197" href="#L197">197</a> } +<a class="jxr_linenumber" name="L198" href="#L198">198</a> } +<a class="jxr_linenumber" name="L199" href="#L199">199</a> } </pre> <hr/> <div id="footer">Copyright © 2002–2024 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</div> Modified: maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/gpg/package-frame.html ============================================================================== --- maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/gpg/package-frame.html (original) +++ maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/gpg/package-frame.html Tue Sep 24 13:04:55 2024 @@ -4,7 +4,7 @@ <!-- generated by Apache Maven JXR (jdk8) --> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <title>Apache Maven GPG Plugin 3.2.6 Reference Package org.apache.maven.plugins.gpg</title> + <title>Apache Maven GPG Plugin 3.2.7 Reference Package org.apache.maven.plugins.gpg</title> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" /> </head> <body> Modified: maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/gpg/package-summary.html ============================================================================== --- maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/gpg/package-summary.html (original) +++ maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/gpg/package-summary.html Tue Sep 24 13:04:55 2024 @@ -4,7 +4,7 @@ <!-- generated by Apache Maven JXR (jdk8) --> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <title>Apache Maven GPG Plugin 3.2.6 Reference Package org.apache.maven.plugins.gpg</title> + <title>Apache Maven GPG Plugin 3.2.7 Reference Package org.apache.maven.plugins.gpg</title> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" /> </head> @@ -23,7 +23,7 @@ <li>Index</li> <li>Help</li> </ul> - <div class="aboutLanguage"><em><strong>Apache Maven GPG Plugin 3.2.6 Reference</strong></em></div> + <div class="aboutLanguage"><em><strong>Apache Maven GPG Plugin 3.2.7 Reference</strong></em></div> </div> <div class="subNav"> <ul class="navList"> @@ -151,7 +151,7 @@ <li>Index</li> <li>Help</li> </ul> - <div class="aboutLanguage"><em><strong>Apache Maven GPG Plugin 3.2.6 Reference</strong></em></div> + <div class="aboutLanguage"><em><strong>Apache Maven GPG Plugin 3.2.7 Reference</strong></em></div> </div> <div class="subNav"> <ul class="navList"> Modified: maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/maven_gpg_plugin/package-frame.html ============================================================================== --- maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/maven_gpg_plugin/package-frame.html (original) +++ maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/maven_gpg_plugin/package-frame.html Tue Sep 24 13:04:55 2024 @@ -4,7 +4,7 @@ <!-- generated by Apache Maven JXR (jdk8) --> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <title>Apache Maven GPG Plugin 3.2.6 Reference Package org.apache.maven.plugins.maven_gpg_plugin</title> + <title>Apache Maven GPG Plugin 3.2.7 Reference Package org.apache.maven.plugins.maven_gpg_plugin</title> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" /> </head> <body> Modified: maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/maven_gpg_plugin/package-summary.html ============================================================================== --- maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/maven_gpg_plugin/package-summary.html (original) +++ maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/org/apache/maven/plugins/maven_gpg_plugin/package-summary.html Tue Sep 24 13:04:55 2024 @@ -4,7 +4,7 @@ <!-- generated by Apache Maven JXR (jdk8) --> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <title>Apache Maven GPG Plugin 3.2.6 Reference Package org.apache.maven.plugins.maven_gpg_plugin</title> + <title>Apache Maven GPG Plugin 3.2.7 Reference Package org.apache.maven.plugins.maven_gpg_plugin</title> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" /> </head> @@ -23,7 +23,7 @@ <li>Index</li> <li>Help</li> </ul> - <div class="aboutLanguage"><em><strong>Apache Maven GPG Plugin 3.2.6 Reference</strong></em></div> + <div class="aboutLanguage"><em><strong>Apache Maven GPG Plugin 3.2.7 Reference</strong></em></div> </div> <div class="subNav"> <ul class="navList"> @@ -81,7 +81,7 @@ <li>Index</li> <li>Help</li> </ul> - <div class="aboutLanguage"><em><strong>Apache Maven GPG Plugin 3.2.6 Reference</strong></em></div> + <div class="aboutLanguage"><em><strong>Apache Maven GPG Plugin 3.2.7 Reference</strong></em></div> </div> <div class="subNav"> <ul class="navList"> Modified: maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/overview-frame.html ============================================================================== --- maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/overview-frame.html (original) +++ maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/overview-frame.html Tue Sep 24 13:04:55 2024 @@ -4,11 +4,11 @@ <!-- generated by Apache Maven JXR (jdk8) --> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <title>Apache Maven GPG Plugin 3.2.6 Reference</title> + <title>Apache Maven GPG Plugin 3.2.7 Reference</title> <link rel="stylesheet" type="text/css" href="stylesheet.css" title="style" /> </head> <body> - <h1 title="Apache Maven GPG Plugin 3.2.6 Reference" class="bar"><strong>Apache Maven GPG Plugin 3.2.6 Reference</strong></h1> + <h1 title="Apache Maven GPG Plugin 3.2.7 Reference" class="bar"><strong>Apache Maven GPG Plugin 3.2.7 Reference</strong></h1> <div class="indexHeader"><span><a href="allclasses-frame.html" target="packageFrame">All Classes</a></span></div> <div class="indexContainer"> <h2 title="Packages">Packages</h2> Modified: maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/overview-summary.html ============================================================================== --- maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/overview-summary.html (original) +++ maven/website/components/plugins-archives/maven-gpg-plugin-LATEST/xref/overview-summary.html Tue Sep 24 13:04:55 2024 @@ -4,7 +4,7 @@ <!-- generated by Apache Maven JXR (jdk7) --> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <title>Apache Maven GPG Plugin 3.2.6 Reference</title> + <title>Apache Maven GPG Plugin 3.2.7 Reference</title> <link rel="stylesheet" type="text/css" href="stylesheet.css" title="style" /> </head> <body> @@ -22,7 +22,7 @@ <li>Index</li> <li>Help</li> </ul> - <div class="aboutLanguage"><em><strong>Apache Maven GPG Plugin 3.2.6 Reference</strong></em></div> + <div class="aboutLanguage"><em><strong>Apache Maven GPG Plugin 3.2.7 Reference</strong></em></div> </div> <div class="subNav"> <ul class="navList"> @@ -37,7 +37,7 @@ </div> <div class="header"> - <h1 class="title">Apache Maven GPG Plugin 3.2.6 Reference</h1> + <h1 class="title">Apache Maven GPG Plugin 3.2.7 Reference</h1> </div> <div class="contentContainer"> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Packages table, listing packages"> @@ -76,7 +76,7 @@ <li>Index</li> <li>Help</li> </ul> - <div class="aboutLanguage"><em><strong>Apache Maven GPG Plugin 3.2.6 Reference</strong></em></div> + <div class="aboutLanguage"><em><strong>Apache Maven GPG Plugin 3.2.7 Reference</strong></em></div> </div> <div class="subNav"> <ul class="navList">