Spring MVC with plugin Minify-Maven-plugin does not recognize the <id> tag

Asked

Viewed 68 times

0

I created a Hello World here with Spring MVC to study the technology and put some client sites on a java server that I have.

Everything has working, but some sites have many files css and js, so I am looking for a solution equal to Microsft Bundle with Asp.net mvc.

No stackoverflow in English have enough people using the Minify-Maven

I particularly found his documentation very poor, or I myself q am covered, will know. On his website it shows the setting to be put on pom.xml.

So far so good. I did all the configuration, this 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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>MeuProjeto</groupId>
  <artifactId>MeuProjeto</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.6</version>
        <configuration>
          <warSourceDirectory>WebContent</warSourceDirectory>
          <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
      </plugin>


        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>src</descriptorRef>
                    </descriptorRefs>
                </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <warSourceExcludes>
                    **/font-awesome.css,**/magnific-popup.css,**/util.js,**/vuid.min.js
                </warSourceExcludes>
            </configuration>
        </plugin>
        <plugin>
            <groupId>com.samaxes.maven</groupId>
            <artifactId>minify-maven-plugin</artifactId>
            <version>1.7.4</version>
            <executions>
                <id>default-minify</id>
                <configuration>
                    <cssSourceFiles>
                        <cssSourceFile>font-awesome.css</cssSourceFile>
                        <cssSourceFile>magnific-popup.css</cssSourceFile>
                    </cssSourceFiles>
                    <jsSourceFiles>
                        <jsSourceFile>util.js</jsSourceFile>
                        <jsSourceFile>vuid.min.js</jsSourceFile>
                    </jsSourceFiles>
                    <jsEngine>CLOSURE</jsEngine>
                    <closureCreateSourceMap>true</closureCreateSourceMap>
                </configuration>
                <goals>
                    <goal>minify</goal>
                </goals>
            </executions>
        </plugin>  


    </plugins>
  </build>
  <dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>4.1.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>4.1.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.1.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>4.1.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.3</version>
    </dependency>
    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>bootstrap</artifactId>
        <version>3.2.0</version>
            <exclusions>
            <exclusion>
                <groupId>org.webjars</groupId>
                <artifactId>jquery</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
    <groupId>org.webjars</groupId>
    <artifactId>jquery</artifactId>
    <version>2.1.1</version>
</dependency>
  </dependencies>
</project>

I downloaded the sample project from the site and copied all the configuration to be as equal to its configuration as possible.

The problem is that it is error in this line of pom.xml:

                <id>default-minify</id>

That mistake:

Description Resource Path Location Type cvc-Complex-type.2.4. a: Invalid content was found Starting with element 'id'. One of '{"http://maven.apache.org/POM/4.0.0":Execution}' is expected. pom.xml /Meuprojeto line 53 XML Problem

I’m trying to understand what this id would be, I don’t want to remove this because in the documentation it is included in basic configuration. Does anyone know the reason for the trouble?

1 answer

0


I forgot to tag <execution>

<executions>
            <execution>
                <id>default-minify</id>
                <configuration>

Just include that it worked.

Browser other questions tagged

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