piranha: Piranha-micro jar returns no main manifest attribute

Given a project wth this pom.xml

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>sh.platform.template</groupId>
    <artifactId>piranha</artifactId>
    <packaging>war</packaging>
    <version>1.0.0-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <platform.sh.version>2.2.3</platform.sh.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <version>4.0.3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>sh.platform</groupId>
            <artifactId>config</artifactId>
            <version>${platform.sh.version}</version>
        </dependency>
        <dependency>
            <groupId>cloud.piranha</groupId>
            <artifactId>piranha-micro</artifactId>
            <version>20.4.0</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>piranha</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.3</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>cloud.piranha</groupId>
                                    <artifactId>piranha-micro</artifactId>
                                    <version>20.4.0</version>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

When I execute:

mvn clean package
java -jar target/dependency/piranha-micro-20.4.0.jar target/piranha.war 

It returns: no main manifest attribute, in target/dependency/piranha-micro-20.4.0.jar

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22

Most upvoted comments

It works, thank you 😃

Hi, it’s very important not to omit the --war argument:

java -jar piranha-micro-20.6.0-SNAPSHOT-all.jar --war piranha.war 

That argument is absolutely crucial in running a war at this moment. Since the project is still in its early stages we haven’t yet implemented all the polishing to warn about missing arguments or to try to infer what was intended etc.

ahhh ok, let me try the 20.6.0 version.

Can you try cloning and building the project? (mvn clean install at top directory should do the work) The result will be at micro/target/piranha-micro-20.6.0-SNAPSHOT-all.jar And run like: java -jar piranha-micro-20.6.0-SNAPSHOT-all.jar --war piranha.war It should be running at http://localhost:8080/hello