Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
83 views
in Technique[技术] by (71.8m points)

java - maven-jar-plugin doesn't create jar

I am trying to set up maven in Intellij IDEA. I have installed maven and set environment variables as below

enviroment varaibles variable Path

I am also using the maven wrapper which I added to my intellij project like this: mvn -N io.takari:maven:0.7.7:wrapper. There is my pom.xml: ` 4.0.0

<groupId>io.github.mat3e</groupId>
<artifactId>hello</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Hello World</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>11</java.version>
    <junit.version>4.12</junit.version>
</properties>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>3.1.1</version>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>io.github.mat3e.App</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>
    </plugins>
</build>

`

when i call a lifecycle method named package like this: "mvnw.cmd package" - then I get [INFO] BUILD SUCCESS but the JAR file is not created in my project (The "target" folder is not created at all) moreover, when calling the method like this: "mvn package" - then I get [INFO] BUILD FAILURE but the "target" folder appears in my project screen of Intellij IDEA and an error occurs:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (d efault-test) on project hello: Execution default-test of goal org.apache.maven.plugins:maven -surefire-plugin:2.12.4:test failed: The forked VM terminated without saying properly goodby e. VM crash or System.exit called ?

I will also share the Project Structure and Maven Runner of my project in the hope that this information may be useful Project Structure Maven Runner

question from:https://stackoverflow.com/questions/65939362/maven-jar-plugin-doesnt-create-jar

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...