You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Artifactory无法识别已添加至Jar包的自定义许可证问题

Troubleshooting Artifactory Auto-Scan Failure for LICENSE.txt in Maven Jars

Since manual Search Archive License File works, the issue is almost certainly tied to how Artifactory's automated scanning pipeline is configured or triggered—not the license file itself. Let’s walk through the most likely fixes step by step:

  • Verify automatic scan triggers and repository settings
    Double-check that your target repository has Enable Automatic License Scanning turned on (under Repository Configuration > Advanced). Also, note that auto-scans often only run on newly deployed artifacts—if you uploaded the jar before configuring the custom license type, you’ll need to manually trigger a rescan for that specific artifact (right-click the jar > Actions > Rescan Licenses).

  • Audit your license regex for edge cases
    Even if you think your regex is correct, small details can break matching in auto-scans:

    • Did you account for line breaks? Add the (?s) prefix (DOTALL mode) to let . match newlines if your license spans multiple lines.
    • Are there unintended spaces or case sensitivity issues? Test your regex against the exact text pulled from the manual scan to ensure it matches perfectly.
    • Did you escape special characters in your company name (like . or &)? Artifactory uses Java regex syntax, so special characters need proper escaping.
  • Check artifact indexing status
    Artifactory relies on artifact indexes to scan archive contents. Navigate to your jar's details page, go to the Index tab, and confirm indexing completed successfully. If it failed, trigger a reindex (Actions > Reindex) and wait for it to finish before checking license recognition again.

  • Ensure scan paths include the jar root directory
    By default, Artifactory might only scan specific paths like META-INF/. Go to Admin > Licenses > License Types, edit your custom license, and check the Archive Paths to Scan field—add LICENSE.txt (or /LICENSE.txt) to explicitly tell Artifactory to look for the file at the jar's root.

  • Dig into Artifactory logs for error clues
    Check the artifactory.log file (usually located in $ARTIFACTORY_HOME/logs) for entries related to your artifact or license scanning. Look for messages like Failed to extract license file or No matches found for license regex—these will pinpoint exactly where the auto-scan is failing.

  • Reconfirm Maven packaging places LICENSE.txt at the jar root
    Even though manual scan finds it, double-check your jar structure with jar tf your-artifact.jar to ensure LICENSE.txt is at the root (not nested in src/ or resources/). If it's misplaced, adjust your Maven resources plugin configuration to copy it correctly:

    <build>
      <resources>
        <resource>
          <directory>${project.basedir}</directory>
          <includes>
            <include>LICENSE.txt</include>
          </includes>
          <targetPath>/</targetPath>
        </resource>
      </resources>
    </build>
    

内容的提问来源于stack exchange,提问作者François Guertin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 06:39:58