Search code examples
javamaven-3myeclipse

Maven can't compile project even when I can debug it


I transferred a big java project to maven and replaced all the libraries used with maven and I can run debug or start just fine meaning that it works normally but for some reason whenever I try to run maven test or install or anything that tries to compile it using maven it fails.

This is my pom file (I use nexus for third party jars):

<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>pbclient2</groupId>
<artifactId>pbclient2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Name</name>
<description>Description</description>
<dependencies>
    <dependency>
        <groupId>c3p0</groupId>
        <artifactId>c3p0</artifactId>
        <version>0.9.1.2</version>
    </dependency>
    .
    .
    .
    <dependency>
        <groupId>mxmlc</groupId>
        <artifactId>mxmlc</artifactId>
        <version>1.0</version>
        <classifier>mxmlc</classifier>
    </dependency>
</dependencies>

<build>
    <resources>
        <resource>
            <directory>src</directory>
        </resource>
    </resources>
    <sourceDirectory>src</sourceDirectory>
    <pluginManagement>
        <plugins>
            <plugin>
                <inherited>true</inherited>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>



            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- <plugin> <groupId>com.google.appengine</groupId> <artifactId>appengine-maven-plugin</artifactId> 
                <version>1.9.32</version> <configuration> <enableJarClasses>false</enableJarClasses> 
                </configuration> <executions> <execution> <goals> <goal>endpoints_get_discovery_doc</goal> 
                </goals> </execution> </executions> </plugin> -->

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <phase>test</phase>
                        <id>analyze</id>
                        <goals>
                            <goal>analyze-only</goal>
                        </goals>
                        <configuration>
                            <failOnWarning>true</failOnWarning>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>
</build></project>

I have tried a lot of plugins and tried deleting the .m2 repository but nothing seems to help.

All the errors I get are

[ERROR] /C:/Users/worx-pc-01/git/PbClient/pbclient2/src/pb/ui/panels/admin/workorders/configuration/namingConvention/GenericNamingConventionTableModel.java:[10,24] package com.pb.hibernate does not exist

or

[ERROR] /C:/Users/worx-pc-01/git/PbClient/pbclient2/src/pb/ui/panels/admin/workorders/configuration/namingConvention/GenericNamingConventionTableModel.java:[192,36] cannot find symbol symbol: class PbPwoNamingConfiguration location: class pb.ui.panels.admin.workorders.configuration.namingConvention.GenericNamingConventionTableModel

The package does exist and I don't understand why this won't work like its supposed to.

enter image description here

Am I doing something wrong since I just started using maven.


Solution

  • The error messages suggest to me that either the package com.pb.hibernate doesn't exist in your project (maybe it has been renamed and your IDE didn't update every use properly) or it exists in an external dependency which your IDE has somehow got in its path when running/debugging, but the dependency isn't defined correctly in your pom, and so running mvn clean install fails