Last release of the bundled themes can be found in the Maven Central repository. The release version is synchronized with the current release of PrimeFaces themes. Add this dependency to your pom.xml and you are done.
<dependencies> ... <dependency> <groupId>org.primefaces.extensions</groupId> <artifactId>all-themes</artifactId> <version>1.0.6</version> </dependency> ... </dependencies>Non Maven users can download the JAR file direct from the Maven Central repository.
You can consider this as an "all-in-one" themes add-on. We don't modify themes, we only collect them by means of the Maven Assembly Plugin. A simple Maven project aggregates PrimeFaces themes and builds a single JAR file with all available themes. Here is a hint how it works. The Maven project with packaging pom is configured as follows:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <configuration> <appendAssemblyId>false</appendAssemblyId> </configuration> <executions> <execution> <id>package-all</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <descriptors> <descriptor>src/main/assembly/all-themes.xml</descriptor> </descriptors> </configuration> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.primefaces.themes</groupId> <artifactId>afterdark</artifactId> <version>${primefaces.theme.version}</version> <scope>runtime</scope> </dependency> ... <dependency> <groupId>org.primefaces.themes</groupId> <artifactId>vader</artifactId> <version>${primefaces.theme.version}</version> <scope>runtime</scope> </dependency> </dependencies> <properties> <primefaces.theme.version>1.0.6</primefaces.theme.version> </properties>The Maven Assembly Plugin takes all dependencies and re-packs them as a single JAR. Repacking instructions are defined in the assembly descriptor all-themes.xml.
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="..."> <id>all-themes</id> <formats> <format>jar</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <dependencySets> <dependencySet> <unpack>true</unpack> <useProjectArtifact>false</useProjectArtifact> <useTransitiveDependencies>false</useTransitiveDependencies> </dependencySet> </dependencySets> </assembly>That's all.
Great post Oleg and excellent solution as always!. Thanks a lot
ReplyDeleteNice one Oleg...what if there are new themes...?
ReplyDeleteAs I said in the related forum post, we will maintain new themes. When 1.0.7 is released, I will try to release bundled themes as 1.0.7 too. No worries.
ReplyDelete+1 is there an option to specify required themes (comma separated theme names)in all-themes.xml instead of selecting all?
ReplyDeleteNo. It would mean 100+ custom builds. There are a lot of possible theme permutations. Every permutation would mean a separate release in the Maven central repo. You should either add required themes "theme by theme" (normal approach) or use "all-in-one" theme JAR with all themes.
ReplyDelete<exclusion> wont help in this case?
ReplyDelete<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.6</version>
<exclusions>
...
</exclusions>
</dependency>
Anyway, great post!
No, you can not exclude sources inside JAR with exclusions :-) You can only exclude dependencies (files) with exclusions.
ReplyDeleteyes you're right i misread the post, the themes are bundled ;)
ReplyDeletethanks.
This is great.
ReplyDeletethx!
Excuse me being a relative newb, but how to incorporate inside Netbeans
ReplyDeletecurrently all I have to do is the following inside web.xml
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>blitzer</param-value>
</context-param>