Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven keeps messing up my java compiler and build path settings

What happens: My java compiler settings are reset from my custom jdk to default java se1.5
When it hapens: Everytime i click maven- update project ( in eclipse of course).

I think it has something to do with the update project settings checkbox. But i cannot find in my pom the tags responsible for configuring my eclipse project. Any hints?

BTW i cannot just uncheck the box because the pom might have other settings vital for my project

EDIT: sorry for the delay, here is my 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">
<!--    <parent> -->
<!--        <groupId>org.geomajas</groupId> -->
<!--        <artifactId>geomajas-parent</artifactId> -->
<!--        <version>1.0.9</version> -->
<!--    </parent> -->
    <modelVersion>4.0.0</modelVersion>
    <groupId>ne</groupId>
    <artifactId>projl</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>TApp</name>
    <description>Test</description>
    <url>http://www.example.com/</url>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.geomajas</groupId>
                <artifactId>geomajas-backend</artifactId>
                <version>1.13.0-SNAPSHOT</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.geomajas</groupId>
                <artifactId>geomajas-face-puregwt</artifactId>
                <version>1.0.0-SNAPSHOT</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.geomajas.plugin</groupId>
                <artifactId>geomajas-plugin-geotools-all</artifactId>
                <version>1.10.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.geomajas.plugin</groupId>
                <artifactId>geomajas-plugin-rasterizing-all</artifactId>
                <version>1.2.0-SNAPSHOT</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.geomajas.plugin</groupId>
                <artifactId>geomajas-widget-puregwt-core-all</artifactId>
                <version>1.0.0-SNAPSHOT</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.geomajas</groupId>
                <artifactId>geomajas-dep</artifactId>
                <version>1.12.28</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.9.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <scope>compile</scope>
        </dependency>

        <!-- Geomajas dependencies -->
        <dependency>
            <groupId>org.geomajas.plugin</groupId>
            <artifactId>geomajas-plugin-rasterizing</artifactId>
        </dependency>
        <dependency>
            <groupId>org.geomajas</groupId>
            <artifactId>geomajas-puregwt-client-impl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.geomajas</groupId>
            <artifactId>geomajas-testdata</artifactId>
        </dependency>
        <dependency>
            <groupId>org.geomajas.plugin</groupId>
            <artifactId>geomajas-layer-geotools</artifactId>
        </dependency>
        <dependency>
            <groupId>org.geomajas.plugin</groupId>
            <artifactId>geomajas-layer-openstreetmap</artifactId>
        </dependency>
        <dependency>
            <groupId>org.geomajas.plugin</groupId>
            <artifactId>geomajas-layer-wms</artifactId>
        </dependency>



        <!-- Google dependencies -->
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwt-version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <version>${gwt-version}</version>
            <scope>runtime</scope>
        </dependency>

        <!-- External GWT libraries -->
        <dependency>
            <groupId>com.google.code.gwt-dnd</groupId>
            <artifactId>gwt-dnd</artifactId>
            <version>3.1.0</version>
        </dependency>

        <!-- logging dependencies, delegate all to slf4j and use logback -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>

            <!-- Run the application using "mvn jetty:run" -->
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.20</version>
                <configuration>
                    <webAppConfig>
                        <contextPath>/</contextPath>
                        <baseResource implementation="org.mortbay.resource.ResourceCollection">
                            <!-- need both the webapp dir and location where GWT puts stuff -->
                            <resourcesAsCSV>${basedir}/src/main/webapp,${project.build.directory}/${project.build.finalName}</resourcesAsCSV>
                        </baseResource>
                    </webAppConfig>
                    <reload>manual</reload>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>2.5.0</version>
                <dependencies>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-user</artifactId>
                        <version>${gwt-version}</version>
                    </dependency>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-dev</artifactId>
                        <version>${gwt-version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <module>the.proj.App</module>
                    <runTarget>index.html</runTarget>
                    <disableCastChecking>true</disableCastChecking>
                    <disableClassMetadata>true</disableClassMetadata>
                    <extraJvmArgs>-Xmx1024M -Xss1024k</extraJvmArgs>
                    <hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
                    <copyWebapp>true</copyWebapp>
                </configuration>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>clean</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.2.1</version>

                <configuration>

                    <!-- Container configuration -->
                    <container>
                        <containerId>tomcat7x</containerId>
                        <type>remote</type>
                    </container>

                    <!-- Configuration to use with the container -->
                    <configuration>
                        <type>runtime</type>
                        <properties>
                            <cargo.remote.username>${dev.deploy.username}</cargo.remote.username>
                            <cargo.remote.password>${dev.deploy.password}</cargo.remote.password>
                            <cargo.remote.uri>${dev.deploy.uri}</cargo.remote.uri>
                        </properties>
                    </configuration>
                    <deployer>
                        <deployables>
                            <deployable>
                                <groupId>org.geomajas</groupId>
                                <artifactId>geomajas-puregwt-showcase</artifactId>
                                <type>war</type>
                                <properties>
                                    <context>showcase-pure-trunk</context>
                                </properties>
                            </deployable>
                        </deployables>
                    </deployer>

                </configuration>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <!-- m2eclipse with embedded jetty -->
        <profile>
            <id>m2e</id>
            <activation>
                <property>
                    <name>m2e.version</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.geomajas</groupId>
                    <artifactId>geomajas-jetty-runner</artifactId>
                    <version>1.0.0</version>
                </dependency>
                <dependency>
                    <groupId>com.google.gwt</groupId>
                    <artifactId>gwt-dev</artifactId>
                    <version>${gwt-version}</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <properties>
                <gwt.compiler.skip>true</gwt.compiler.skip>
            </properties>
        </profile>
        <profile>
            <id>skipGwt</id>
            <activation>
                <property>
                    <name>skipGwt</name>
                </property>
            </activation>
            <properties>
                <gwt.compiler.skip>true</gwt.compiler.skip>
            </properties>
        </profile>

        <profile>
            <id>selenium-tests</id>
            <activation>
                <property>
                    <name>!skipSelenium</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <!-- Run the application using "mvn jetty:run" -->
                    <plugin>
                        <groupId>org.mortbay.jetty</groupId>
                        <artifactId>maven-jetty-plugin</artifactId>
                        <configuration>
                            <webAppConfig>
                                <contextPath>/</contextPath>
                            </webAppConfig>
                            <reload>manual</reload>
                            <stopPort>9966</stopPort>
                            <stopKey>stop-jetty</stopKey>
                        </configuration>
                        <executions>
                            <execution>
                                <id>start-jetty</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <daemon>true</daemon>
                                    <scanIntervalSeconds>5</scanIntervalSeconds>
                                    <connectors>
                                        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                                            <port>9080</port>
                                            <maxIdleTime>60000</maxIdleTime>
                                        </connector>
                                    </connectors>
                                </configuration>
                            </execution>
                            <execution>
                                <id>stop-jetty</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <includes>
                                        <include>**/*TestInt.java</include>
                                        <include>**/IntTest*.java</include>
                                    </includes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

<repositories>
        <repository>
            <id>Geomajas</id>
            <name>Geomajas repository</name>
            <url>http://maven.geomajas.org/</url>
        </repository>

        <!-- uncomment if you want to use Geomajas snapshots, comment for faster builds -->

        <repository>
            <id>Geomajas-latest</id>
            <name>Geomajas snapshot repository</name>
            <url>http://apps.geomajas.org/nexus/content/groups/latest</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>Geomajas</id>
            <name>Geomajas repository</name>
            <url>http://maven.geomajas.org/</url>
        </pluginRepository>
    </pluginRepositories>

    <properties>
        <gwt-version>2.5.1</gwt-version>
        <gwt.compiler.skip>false</gwt.compiler.skip>
    </properties>

</project>
like image 593
osh Avatar asked Feb 17 '23 00:02

osh


1 Answers

I am not quite sure about your problem but I believe m2e plugin get the source/output version by setting of compiler plugin.

In your POM, have something like

....
<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <configuration>
        <source>1.6</source>
        <target>1.6</target>
      </configuration>
    </plugin>
      .....
  </plugins>
</build>

m2e should be able to configure your Eclipse according to the source and target version

like image 92
Adrian Shum Avatar answered Feb 27 '23 12:02

Adrian Shum