IDEAjavaコンパイルおよびjarパッケージへのパッケージ化

IDEAを使用してjarパッケージにパッケージ化するのは初めてです。
オンラインチュートリアルに従ってパッケージ化して見つけてください。
何も機能しません。BUILDFAILURE
エラーメッセージには、役に立たない情報がたくさん含まれて
います。情報は次のとおりです。

[INFO]
[INFO] ---------------------------< com.px82:other >---------------------------
[INFO] Building other 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ other ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 11 resources
[INFO] The encoding used to copy filtered properties files have not been set. This means that the same encoding will be used to copy filtered properties files as when copying other filtered resources. This might not be what you want
! Run your build with --debug to see which files might be affected. Read more at https://maven.apache.org/plugins/maven-resources-plugin/examples/filtering-properties-files.html
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ other ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 184 source files to F:\project\AI\axc.px82.com\LoopV5\bsn_sdk_py\OtherSytemDemo\PCNGateway-Java-SDK-Demo2\other\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.910 s
[INFO] Finished at: 2020-12-30T11:08:30+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project other: Compilation failure -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

1時間勉強した後、コマンドラインでmvn installを直接実行して報告されたエラーは無意味であると
最終的に要約しまし
た。-Xパラメータを追加しても意味がありません
。IDEAでマウスを使用する場合は、それを実行すると、エラーが報告されますコンテンツは貴重です。

最初のステップは、コンパイルが成功したかどうかを確認することです
ここに画像の説明を挿入
。2番目のステップ:問題がないことを確認します
ここに画像の説明を挿入
。3番目のステップ:ディレクトリD:\ apache-maven-3.6.3 \ conf \ settingsのファイル構成であるmavenを確認します。 .xml。中国にAlibabaCloudを追加すると、jarパッケージのダウンロード速度が効果的に向上します。私の構成は次のとおりです。AlibabaCloudのミラーソース

<mirrors> 
       <mirror>
            <id>alimaven</id>
            <mirrorOf>central</mirrorOf>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
        </mirror>
        <mirror>
            <id>nexus-aliyun</id>
            <mirrorOf>*</mirrorOf>
            <name>Nexus aliyun</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public</url>
        </mirror>
        <!-- 中央仓库1 -->
        <mirror>
            <id>repo1</id>
            <mirrorOf>central</mirrorOf>
            <name>Human Readable Name for this Mirror.</name>
            <url>http://repo1.maven.org/maven2/</url>
        </mirror>
    
        <!-- 中央仓库2 -->
        <mirror>
            <id>repo2</id>
            <mirrorOf>central</mirrorOf>
            <name>Human Readable Name for this Mirror.</name>
            <url>http://repo2.maven.org/maven2/</url>
        </mirror>
  </mirrors>

ステップ4:最初にクリーンアップし
ここに画像の説明を挿入
ます。ステップ5:生成されたターゲットがjarパッケージかwarパッケージかを確認します。
ここに画像の説明を挿入

ステップ6:
ここに画像の説明を挿入
このステップへのmavenインストールの実行は正常にパッケージ化されています。
に

手順7:コマンドラインでjavaコマンドを実行します。java-rbsn-java.jarでWebサイトを起動できます。

パッケージを開けない場合や、バージョンが正しくない場合は、
https://mvnrepository.com/にアクセスして
、対応するパッケージのバージョン確認してください

おすすめ

転載: blog.csdn.net/phker/article/details/111953130