maven include resources in jar



  • I have a component for apache-tapestry, which includes java js, js, cs. There are no resource files in the jar-e pool. The js files themselves, the css are not in. src/main/resourcesand in a java bag of classes. How do you tell the meven that when the project is assembled, it includes them in jar?

    введите сюда описание изображения

    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>
    
    &lt;groupId&gt;com.inlandia.tap5.components&lt;/groupId&gt;
    &lt;artifactId&gt;inlandia-components&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
    &lt;name&gt;Inlandia Components Library&lt;/name&gt;
    
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.apache.tapestry&lt;/groupId&gt;
            &lt;artifactId&gt;tapestry-core&lt;/artifactId&gt;
            &lt;version&gt;${tapestry-release-version}&lt;/version&gt;
        &lt;/dependency&gt;
    &lt;/dependencies&gt;
    
    &lt;build&gt;
        &lt;plugins&gt;
            &lt;plugin&gt;
                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                &lt;configuration&gt;
                    &lt;encoding&gt;UTF-8&lt;/encoding&gt;
                    &lt;source&gt;1.8&lt;/source&gt;
                    &lt;target&gt;1.8&lt;/target&gt;
                    &lt;optimize&gt;true&lt;/optimize&gt;
                &lt;/configuration&gt;
            &lt;/plugin&gt;
    
            &lt;plugin&gt;
                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                &lt;configuration&gt;
                    &lt;archive&gt;
                        &lt;manifestEntries&gt;
                            &lt;Tapestry-Module-Classes&gt;com.inlandia.tap5.services.InlandiaModule
                            &lt;/Tapestry-Module-Classes&gt;
                        &lt;/manifestEntries&gt;
                    &lt;/archive&gt;
                &lt;/configuration&gt;
            &lt;/plugin&gt;
        &lt;/plugins&gt;
    &lt;/build&gt;
    
    &lt;repositories&gt;
        &lt;repository&gt;
            &lt;id&gt;codehaus.snapshots&lt;/id&gt;
            &lt;url&gt;http://snapshots.repository.codehaus.org&lt;/url&gt;
        &lt;/repository&gt;
        &lt;repository&gt;
            &lt;id&gt;OpenQA_Release&lt;/id&gt;
            &lt;name&gt;OpenQA Release Repository&lt;/name&gt;
            &lt;url&gt;http://archiva.openqa.org/repository/releases/&lt;/url&gt;
        &lt;/repository&gt;
    &lt;/repositories&gt;
    
    &lt;properties&gt;
        &lt;tapestry-release-version&gt;5.4-rc-1&lt;/tapestry-release-version&gt;
    &lt;/properties&gt;
    

    </project>



  • Add something like that:

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>
    

    Use the directives include and exclude

    https://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2