Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven NumberFormatException when packaging

Tags:

java

maven

I'm getting a really weird error on my Windows PC when running mvn package (or mvn install/deploy) on a project. This error only happens on this machine, everything works fine on my laptop and other computers. I used to be able to package/install the project without problems, but now even older commits and branches throw this exception.

java.lang.NumberFormatException: For input string: "34m[[["
    at java.lang.NumberFormatException.forInputString(NumberFormatException java:65)
    at java.lang.Integer.parseInt(Integer.java:580)
    at java.lang.Integer.<init>(Integer.java:867)
    at org.fusesource.jansi.AnsiOutputStream.write(AnsiOutputStream.java:12)
    at java.io.FilterOutputStream.write(FilterOutputStream.java:125)
    at java.io.PrintStream.write(PrintStream.java:480)
    at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
    at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:282)
    at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125)
    at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207)
    at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129)
    at java.io.PrintStream.write(PrintStream.java:526)
    at java.io.PrintStream.print(PrintStream.java:669)
    at java.io.PrintStream.println(PrintStream.java:806)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:423)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

Console error screenshot

I'm using Maven 3.5.2 and Java 1.8.0_91. I already tried reinstalling Maven.

I found this SO post that apparently has a similar problem, but there are no solutions posted.
Anybody have an idea what could cause this?

If I run it with mvn clean install -B it produces the following error for the whole console log:
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
(screenshot)

Here's my POM file:

<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>****</groupId>
    <artifactId>sniffer</artifactId>
    <version>0.6-SNAPSHOT</version>

    <name>sniffer</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <packaging>pom</packaging>

    <modules>
        <module>sniffergui</module>
        <module>sniffercollector</module>
        <module>snifferapp</module>
        <module>snifferstats</module>
    </modules>

    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.0.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.0.1</version>
        </dependency>
        <dependency>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
                <version>4.12.1</version>
        </dependency>
        <dependency>
                <groupId>org.junit.platform</groupId>
                <artifactId>junit-platform-launcher</artifactId>
                <version>1.0.1</version>
        </dependency>
        <dependency>
                <groupId>org.junit.platform</groupId>
                <artifactId>junit-platform-runner</artifactId>
                <version>1.0.1</version>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>PRISE_gruppe_5_releases</id>
            <name>sniffer_releases</name>
            <url>http://prise-runner.aot.tu-berlin.de:8081/repository/PRISE_gruppe_5_releases/</url>
        </repository>
        <repository>
            <id>PRISE_gruppe_5_snapshots</id>
            <name>sniffer_snapshots</name>
            <url>http://prise-runner.aot.tu-berlin.de:8081/repository/PRISE_gruppe_5_snapshots/</url>
        </repository>
    </repositories>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-maven-plugin</artifactId>
                    <version>3.1.1</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <effort>Max</effort>
                        <threshold>Low</threshold>
                        <xmlOutput>true</xmlOutput>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>3.8</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.0</version>
                    <executions>
                        <execution>
                            <id>pre-unit-test</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <configuration>
                                <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
                                <propertyName>surefireArgLine</propertyName>
                            </configuration>
                        </execution>
                        <execution>
                            <id>post-unit-test</id>
                            <phase>test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <dataFile>${project.build.directory}/coverage-reports/jacoco.exec</dataFile>
                                <outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.19.1</version>
                    <configuration>
                        <argLine>${surefireArgLine}</argLine>
                        <skipTests>${skip.unit.tests}</skipTests>
                        <excludes>
                            <exclude>**/IT*.java</exclude>
                        </excludes>
                    </configuration>
                        <dependencies>
                             <dependency>
                                <groupId>org.junit.platform</groupId>
                                <artifactId>junit-platform-surefire-provider</artifactId>
                                <version>1.0.1</version>
                             </dependency>
                             <dependency>
                                <groupId>org.junit.jupiter</groupId>
                                    <artifactId>junit-jupiter-engine</artifactId>
                                <version>5.0.1</version>
                             </dependency>
                        </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>2.15</version>
                    <executions>
                        <execution>
                            <id>integration-tests</id>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                            <configuration>
                                <argLine>${failsafeArgLine}</argLine>
                                <skipTests>${skip.integration.tests}</skipTests>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <distributionManagement>
        <repository>
            <id>***_releases</id>
            <name>sniffer_releases</name>
            <url>*****</url>
        </repository>
        <snapshotRepository>
            <id>***_snapshots</id>
            <name>sniffer_snapshots</name>
            <url>*****</url>
        </snapshotRepository>
    </distributionManagement>
</project>
like image 903
cactus Avatar asked Feb 10 '18 18:02

cactus


People also ask

What causes NumberFormatException in Java?

The NumberFormatException is an unchecked exception in Java that occurs when an attempt is made to convert a string with an incorrect format to a numeric value. Therefore, this exception is thrown when it is not possible to convert a string to a numeric type (e.g. int, float).

Is NumberFormatException a runtime exception?

The NumberFormatException occurs when an attempt is made to convert a string with improper format into a numeric value. That means, when it is not possible to convert a string in any numeric type (float, int, etc), this exception is thrown. It is a Runtime Exception (Unchecked Exception) in Java.

Which is the immediate super class of NumberFormatException?

The NumberFormatException is a built-in class in java that is defined in the Java. lang. NumberFormatException package. The IllegalArgumentException class is a superclass of the NumberFormatException as it is an unchecked exception, so it is not forced to handle and declare it.


1 Answers

As @Oleg said in the comments, set MAVEN_OPTS=-Xss10M seems to fix the issue. It sometimes has to be called again if the error returns. All other options did not solve the problem for me.

like image 95
cactus Avatar answered Oct 03 '22 15:10

cactus