OS: Debian GNU/Linux 12 (bookworm) vscode: 1.88.1
Java11で簡単なGUIアプリケーションを開発する目的。vscodeに拡張機能をインストールし、mavenを使用してプロジェクトを作成する。
mavenをインストールしてmvnを実行できるようにしておく Microsoftの拡張機能「Extension Pack for Java」をインストール コマンドパレットからArchetypeを使用せずプロジェクト作成
下記を参考にpom.xmlを編集後、vscodeのプライマリサイドバーのMAVENから「mvn package」コマンドを実行すると実行可能jarファイルをビルドできる。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.hirohiro716</groupId>
<artifactId>example</artifactId>
<version>latest</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<build>
<finalName>${project.name}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.hirohiro716.Example</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>