Is it possible to use the maven resource for reusable use?

Is it possible to create a maven artifact that will contain only resources, but not sources, and which can be reused by other projects?

The motivation is this. I have a library that contains only html / css / javascript code. This library should be packaged as resources in a military project. At the moment I am creating a web archive with resources with one pom. But can I separate the html / css / javascript code in a new artifact and reuse it in several military projects?

+5
source share
5 answers
+9

, maven -.

, , . CSS CSS java- jar WEB-INF/lib.

- WAR , .

0

:

$ ls -R
.:
pom.xml  src

./src:
main

./src/main:
resources

./src/main/resources:
README.txt  content-is-here.txt

$ mvn package
... Maven doing it thing...

$ unzip -l target/test-1.0-SNAPSHOT.jar
Archive:  target/test-1.0-SNAPSHOT.jar
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  02-25-2010 16:18   META-INF/
      123  02-25-2010 16:18   META-INF/MANIFEST.MF
       10  02-25-2010 16:18   content-is-here.txt
        0  02-25-2010 16:18   README.txt
        0  02-25-2010 16:18   META-INF/maven/
        0  02-25-2010 16:18   META-INF/maven/group/
        0  02-25-2010 16:18   META-INF/maven/group/test/
      626  02-25-2010 16:15   META-INF/maven/group/test/pom.xml
      106  02-25-2010 16:18   META-INF/maven/group/test/pom.properties
---------                     -------
      865                     9 files
0

jarring src/main/resources validate, . pom , pom :

 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
       <execution>
          <id>unpack</id>
          <phase>validate</phase>
          <goals>
             <goal>unpack</goal>
          </goals>
          <configuration>
             <artifactItems>
                <artifactItem>
                   <groupId>my.company</groupId>
                   <artifactId>resource-artifact</artifactId>
                   <version>1.0</version>
                   <overWrite>true</overWrite>
                   <outputDirectory>src/main/resources</outputDirectory>
                </artifactItem>
             </artifactItems>
          </configuration>
       </execution>
    </executions>
 </plugin>
0
source

All Articles