maven-jar-plugin

<plugin>
<!-- Build an executable JAR -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <archive>
                        <manifest>
<!--                            <addClasspath>true</addClasspath>-->
<!--                            <classpathPrefix>lib/</classpathPrefix>-->
                            <mainClass>main.Application</mainClass>
                        </manifest>
                    </archive>
                </configuration>
</plugin>


Nếu bạn có một file .jar hoặc .war và dùng câu lệnh java -jar app.jar mà không thực thi được chương trình

thì khi đó bạn cần add plugin bên trên vào file pom.xml và build lại toàn bộ suorce code.

Lúc này trình maven sẽ chỉ rõ file chứa hàm main để chạy chương trình
<mainClass>main.Application</mainClass>

hai tham số config bên dưới là không quan trọng bạn có thể bỏ qua, bạn nên tìm hiểu thêm
<addClasspath>true</addClasspath><classpathPrefix>lib/</classpathPrefix>



Comments

Popular posts from this blog

Fixing the DeepSpeed Import Error While Fine-Tuning the Qwen Model

Amazon Linux 2023 - User data configuration for launch templates to connect to the EKS cluster

How to create ISM policy and rotate logs in opensearch