Maven changing the faces-config.xml

Asked

Viewed 320 times

0

I have an EJB project and my Maven keeps changing the faces-config.xml when I run "mvn install", Maven changes everything inside it leaving without the paths I specify, follows my "pom" file of the WEB project

<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>
    <artifactId>WEB</artifactId>
    <packaging>war</packaging>
    <properties>
        <basedir>${project.basedir}</basedir>
    </properties>
    <parent>
        <groupId>br.com.empresa</groupId>
        <artifactId>Pai</artifactId>
        <version>1</version>
    </parent>
    <dependencies>
        <!-- dependencia de projetos -->

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>EJBClient</artifactId>
            <version>1</version>
            <optional>true</optional>
        </dependency>
            <artifactId>seguranca</artifactId>
            <groupId>br.com.empresa/groupId>
            <version>1.14</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <artifactId>utilitarios</artifactId>
            <groupId>br.com.empresa</groupId>
            <version>1.16</version>
        </dependency>

        <dependency>
            <artifactId>batch-api</artifactId>
            <groupId>br.com.empresa</groupId>
            <version>1.0</version>
            <scope>provided</scope>
        </dependency>

        <!-- commons -->
        <dependency>
            <artifactId>commons-beanutils</artifactId>
            <groupId>commons-beanutils</groupId>
            <version>1.8.3</version>
        </dependency>

        <dependency>
            <artifactId>commons-collections</artifactId>
            <groupId>commons-collections</groupId>
            <version>2.1</version>
        </dependency>

        <dependency>
            <artifactId>commons-digester</artifactId>
            <groupId>commons-digester</groupId>
            <version>2.1</version>
        </dependency>

        <!-- ibm -->
        <dependency>
            <groupId>com.ibm.icu</groupId>
            <artifactId>icu4j</artifactId>
            <version>52.1</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.ibm.websphere.j2ee</groupId>
            <artifactId>j2ee</artifactId>
            <version>7.0.0.29</version>
        </dependency>

        <dependency>
            <groupId>com.ibm.faces</groupId>
            <artifactId>jsf-ibm</artifactId>
            <version>20100702_1406</version>
        </dependency>

        <dependency>
            <artifactId>classworlds</artifactId>
            <groupId>classworlds</groupId>
            <version>1.1</version>
        </dependency>

        <dependency>
            <artifactId>jasperreports</artifactId>
            <groupId>net.sf.jasperreports</groupId>
            <version>5.5.1</version>
        </dependency>

        <dependency>
            <artifactId>junit</artifactId>
            <groupId>junit</groupId>
            <version>3.8.1</version>
        </dependency>

        <dependency>
            <artifactId>plexus-utils</artifactId>
            <groupId>plexus</groupId>
            <version>1.0.2</version>
        </dependency>

        <dependency>
            <artifactId>poi</artifactId>
            <groupId>org.apache.poi</groupId>
            <version>3.11</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <artifactId>javax.faces-api</artifactId>
            <groupId>javax.faces</groupId>
            <version>2.2</version>
        </dependency>

        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>2.0.1</version>
        </dependency>

        <dependency>
            <groupId>com.ibm.websphere</groupId>
            <artifactId>sitelib</artifactId>
            <version>7.0.0.21</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
    </dependencies>
    <build>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <webappDirectory>WebContent</webappDirectory>
                    <webXml>WebContent/WEB-INF/web.xml</webXml>
                    <!-- <archive> -->
                    <!-- <manifestFile>WebContent/META-INF/MANIFEST.MF</manifestFile> -->
                    <!-- <manifest> -->
                    <!-- <addClasspath>true</addClasspath> -->
                    <!-- </manifest> -->
                    <!-- </archive> -->
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

What could be?

  • Su XML is poorly formed. In the second dependency is missing the <dependency> shortly after the </dependency> first dependency. This is also wrong here: <groupId>br.com.empresa/groupId>, because the < before the /groupId>.

  • Are you using an IDE? I’ve had problems where the IDE would automagically change files like this one. In the end, it wasn’t Maven’s fault.

  • I’m using RSA, which is a version of the ibm eclipse, but it "formats" faces-config.xml at the time I run "mvn install" by the command prompt, not by RSA. Maven somehow moves faces-config.xml?

  • The Maven shouldn’t be messing with this file unless something very unusual is going on. But the IDE can detect Maven by running and then tinkering with the file. If you close the RSA completely and run the mvn clean install by the prompt, what happens?

  • It keeps erasing the faces-config.xml, I really have no idea what might be going on, could be some plugin, or something like that

  • If you put the faces-config.xml how to read-only and rotate the Maven, gives way at some stage of the process?

  • I haven’t tried that yet, as I put faces-config.xml only as read?

  • Operating system has the possibility to mark files as read-only.

  • Trim this error when I change the read-only configuration: Could not copy webapp sources [C: Users Documents Workspace Web Project Webcontent]: C: Users Documents Workspace Web Project Webcontent WEB-INF faces-config.xml (Access denied.) -> [Help 1]

  • This error is good, and means that the file could not be overwritten. Does Maven have a stacktrace? If yes, edit the question to add it, as in this case stacktrace will report what was the action of Maven that tried to overwrite the file. Also put what is the full path of your file faces-config.xml which should not be altered.

Show 5 more comments

1 answer

-1

In my case I did it:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>${maven-war.version}</version>
            <configuration>
                <webXml>WebContent\WEB-INF\web.xml</webXml>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <classpathPrefix>lib/</classpathPrefix>
                    </manifest>
                </archive>
                <webResources>
                    <resource>
                        <directory>WebContent\WEB-INF\</directory>
                        <targetPath>WEB-INF</targetPath>
                        <includes>
                            <include>faces-config.xml</include>
                        </includes>
                    </resource>
                </webResources>
            </configuration>
        </plugin>
        ...
    </plugins>
</build>
  • Can you translate and explain the answer pf?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.