Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin AND more

The project has only one package containing all the .java files.

When I run it using maven, it complains:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project wx.center: Compilation failure: Compilation failure:

A dozen of errors look like these:

[ERROR] C:\Users\...\wx\center\TokenJob.java:[57,53] ERROR: needs';'
[ERROR] C:\Users\...\wx\center\TokenJob.java:[88,10] ERROR: there is 'catch', but no 'try'
[ERROR] C:\Users\...\wx\center\TokenJob.java:[88,26] ERROR: needs')'
[ERROR] C:\Users\...\wx\center\TokenJob.java:[90,10] ERROR: there is 'finally', but no 'try'

I have checked the eclipse settings,

and

As you can see, I have assigned the "installed JRE" and it matches the jre used by compiler.

And I have used vim to check the coding of TokenJob.java file, it looks ok.

All "errors" are around TokenJob.java file, so I commented the whole class leaving only

public class TokenJob {}

Then odd things happen, some other java files ask me to import java file that is already located in the same package, which should not.

I tried to copy TokenJob out and back, the same. I tried the above operation several times, and the "import java file in the same package" happens at random references/places.

This is my pom:

<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.xxxx</groupId>
    <artifactId>wx.center</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>com.xxxx.wx.center.MainClass</mainClass>
                                </transformer>
                            </transformers>
                            <shadedArtifactAttached>true</shadedArtifactAttached>
                            <shadedClassifierName>executable</shadedClassifierName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

All I want is getting the jar file using maven. Thanks!

Answers


I think the problem is with shade plugin so read this carefully https://maven.apache.org/plugins/maven-shade-plugin/ The alternative solution may be http://www.mkyong.com/maven/how-to-create-a-jar-file-with-maven/


Try deleting everything in your Markers and Problems tab in eclipse and then try to build the project.


Need Your Help

How to load datatables correctly

javascript jquery jquery-datatables

I have an issue with datatables, I admit it's my first expirence with that plugin, so maybe something a bit silly.

Wolfram Alpha and Logic - NOR transformation

logic logical-operators wolframalpha

i have some difficulties interpret some WolframAlpha logic.