Element faces-config must be declared - intellij-idea

I've got this error in project faces-config.xml file in my IntelliJ IDE:
Element faces-config must be declared
Here is my faces-config.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_3_0.xsd"
version="2.3">
</faces-config>
And pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>9.1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
</plugins>
</build>
</project>
How can I fix this?

xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_3_0.xsd"
Try opening http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_3_0.xsd in your favorite webbrowser. It returns 404. In other words, this URL is not correct. The IDE's built-in XML parser is also struggling this way. It cannot find the declaration of <faces-config> root element there.
It's not clear which JSF version exactly you intend to develop with. If it's 2.3, as indicated by version="2.3", then you should be using http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd instead, as specified in "Java EE 8 Schema Resources" section of the webpage behind http://xmlns.jcp.org/xml/ns/javaee.
<faces-config
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd"
version="2.3">
But if it's indeed 3.0, the first Jakartified version (i.e. you should be using jakarta.* package for Jakarta EE API over all place instead of javax.* package), then you should be using the following deployment descriptor root declaration as specified in "Jakarta EE 9" section of the webpage behind https://jakarta.ee/xml/ns/jakartaee.
<faces-config
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_3_0.xsd"
version="3.0">
See also:
Jakarta Faces 4.0 specification - 11.3.5 Application Configuration Resource Format

Related

Spring Cloud Config Server - Expected Memory Footprint Seems Large

Spring Cloud Config Server - 1.4.2.RELEASE
Java 8
I have a vanilla Spring Cloud Config Server (POM below).
Main features used are:
downloading config files from Git
encryption/decryption through an SSH file
When I start it up with no memory constraints it cranks up to 7460.88 Mb.
When I add constraints like below, it is at 3653.82 Mb.
-Xms256m -Xmx256m -Xmn96m -XX:+UseNUMA -XX:+UseG1GC -XX:+AlwaysPreTouch -XX:+PerfDisableSharedMem -XX:+ParallelRefProcEnabled
As you can tell by my memory constraints I was expecting it to hang out around 256 Mb.
Was this an unrealistic expectation?
Is there a way to get it down further?
<?xml version="1.0" encoding="UTF-8"?>
<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>any.group</groupId>
<artifactId>spring-cloud-config-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>spring-cloud-config-server</name>
<description>Spring-Cloud-Config-Server that loads configuration from GIT for Spring Boot Applications.</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>1.4.2.RELEASE</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
<version>${spring-cloud.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Nevermind, believe I was calculating the memory wrong.
I was using this command originally: https://stackoverflow.com/a/44711589/4681044
But instead now I used the "top" command and got the percentage and used that against the total available and got 492Mb.

FATAL ERROR while compiling Project using Maven 2

I am new to Maven and starting moving my project to maven. I have created the following POM.
when i issue install command, it gives me FATAL ERROR.
I am using maven 2.2.1 version and JDK 1.5.
My POM is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<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>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<groupId>my.project.group</groupId>
<artifactId>my.artifact</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.6.SEC01</version>
</dependency>
</dependencies>
</project>
Thanks for any help.
You are missing a mandatory tag from your project address structure groupId:artifactId:version
Put the following tag after ... with some version info (i.e. 1.x.x) and try.
<version>1.0.0</version>
Reference : http://maven.apache.org/pom.html

How to change the qualifier in the file names of plugins and features

I am trying to rename my artifacts in the repository folder of my eclipse-repository module. At the moment they are auto generated like ...1.0.0.v20130315-1927.jar.
I haven't found any configuration parameter that works. I have tried to use the qualifier setting in the configuration (see tycho-p2-repository-plugin), but it doesn't work.
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>development.statTool</groupId>
<artifactId>Application</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>development.statTool</groupId>
<artifactId>development.statTool.p2</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-repository</packaging>
<properties>
<tycho-version>0.16.0</tycho-version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-repository-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<qualifier>abcd</qualifier>
</configuration>
</plugin>
</plugins>
</build>
</project>
My solution is to use the tycho-packaging-plugin. Only "disadvantage" changing the build qualifier needs to rebuild all modules contained by the repository.
Here the part out of my parent pom.xml:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<version>${tycho.version}</version>
<dependencies>
<dependency>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-buildtimestamp-jgit</artifactId>
<version>${tycho-extras.version}</version>
</dependency>
</dependencies>
<configuration>
<strictBinIncludes>false</strictBinIncludes>
<format>'rev${rev}-'yyyyMMdd-HHmm</format>
</configuration>
</plugin>
try this:
mvn -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=13.3.0.1-SNAPSHOT
or simply search text "1.0.0-SNAPSHOT" and replace it with "13.3.0.1" using Actual Search and Replace tool.

Maven copy src/main/resources/services folder to /META-INF

EDIT
Ok I can be now more specific:
I have in my scr/main/resources a folder META-INF who contains services/javax.annotation.processing.Processor
My pom is still the same (with commented).
If I do "mvn clean install", the output jar will contains only the META-INF folder.
But if I rename the folder services, the output jar contains my classes and the META-INF folder with the new renamed folder and his content.
I have - I suppose - a easy question for regular maven2 users.
I have this simple pom for a simple subproject
<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>aida</groupId>
<version>0.0.1-SNAPSHOT</version>
<artifactId>aida-annotationProcessors</artifactId>
<packaging>jar</packaging>
<name>AIDA Annotation Processors</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
<!-- <resources> -->
<!-- <resource> -->
<!-- <directory>src/main/resources/services</directory> -->
<!-- <targetPath>META-INF/services</targetPath> -->
<!-- </resource> -->
<!-- </resources> -->
</build>
<dependencies>
</dependencies>
</project>
My goal is simple:
I just want to copy my src/main/resources/services/javax.annotation.processing.Processor file in the {root}/META-INF/services folder of my generated jar.
But if I uncomment the resource part, my jar will contains only a META-INF folder without class!
Could you help me?
This is a bug/feature in the maven compiler plugin..
http://jira.codehaus.org/browse/MCOMPILER-97
A workaround is to disable annotation processing for the project containing the processor, -proc:none.
A more flexible solution would be to use an annotation processor for generating the services/javax.annotation.processing.Processor file, that way the classes are left intact and no extra work is required if the project depends on additional annotation processors.
META-INF/services generator is in main repo:
<dependency>
<groupId>org.kohsuke.metainf-services</groupId>
<artifactId>metainf-services</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
Annotate the processors with #MetaInfServices - note that I had to manually supply the annotation with Processor.class, otherwise it generated META-INF/services/javax.annotation.processing.AbstractProcessor
import org.kohsuke.MetaInfServices;
#MetaInfServices(javax.annotation.processing.Processor.class)
public class SoapPropertyProcessor extends AbstractProcessor
Here are the instructions from Apache for how to do that, but it appears that you're doing it correctly. Take a look at that page and make sure you're not making some small error.

Maven : OSGI, bundles and multi-modules projects

I'm currently developing an OSGi based application (using Equinox) by trying to mavenize a web tutorial I've found on OSGi+Equinox. In this project, there are bundles depending on other bundles (quote-service depends on quote).
The compile phase does succeed, but the package phase does not. Maven complains the following :
[INFO] [bundle:bundle]
[ERROR] Error building bundle de.vogella.osgi:quote-service:bundle:0.0.1 : Unresolved references to [de.vogella.osgi.quote] by class(es) on the Bundle-Classpath[Jar:dot]: [de/vogella/osgi/quoteservice/Activator.class, de/vogella/osgi/quoteservice/QuoteService.class]
[ERROR] Error(s) found in bundle configuration
I do understand the problem, but do not see how to make it work.
This is the quote's pom :
<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">
<parent>
<artifactId>osgi-first-app</artifactId>
<groupId>de.vogella.osgi</groupId>
<version>0.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>de.vogella.osgi</groupId>
<artifactId>quote</artifactId>
<packaging>bundle</packaging>
<name>Quote Bundle</name>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
<_include>src/main/resources/META-INF/MANIFEST.MF</_include>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
and the quote's bundle manifest :
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Quote Plug-in
Bundle-SymbolicName: de.vogella.osgi.quote
Bundle-Activator: de.vogella.osgi.quote.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.osgi.framework;version="1.3.0"
Export-Package: de.vogella.osgi.quote
Then the quote-service's pom :
<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">
<parent>
<artifactId>osgi-first-app</artifactId>
<groupId>de.vogella.osgi</groupId>
<version>0.0.1</version>
</parent>
<dependencies>
<dependency>
<groupId>de.vogella.osgi</groupId>
<artifactId>quote</artifactId>
<version>0.0.1</version>
<type>bundle</type>
</dependency>
</dependencies>
<modelVersion>4.0.0</modelVersion>
<groupId>de.vogella.osgi</groupId>
<artifactId>quote-service</artifactId>
<packaging>bundle</packaging>
<name>Quote Service Bundle</name>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
<_include>src/main/resources/META-INF/MANIFEST.MF</_include>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
And finally the quote-service's manifest :
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Quoteservice Plug-in
Bundle-SymbolicName: de.vogella.osgi.quoteservice
Bundle-Activator: de.vogella.osgi.quoteservice.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.osgi.framework;version="1.3.0", \
de.vogella.osgi.quote;version="0.0.1"
Is there something wrong ? Thank you in advance !
The answer is quite simple : I removed the already defined manifest, and used bnd entries in the bundle plugin instructions. That works !
Tycho is designed to handle these types of problems.
I wrote a tool called auto-builder: http://code.google.com/p/auto-builder. It introspects PDE-based projects and generates Ant build files; it supports transitive closure over dependencies and all that jazz.
I posted a write-up: http://empty-set.net/?p=9. I wrote it because the Maven tools I played with, when integrated with PDE, didn’t “just work.” Basically, I wanted to do coding in PDE and have a Hudson-based CI without any fuss in between.
Generating Ant files is nice because it gives you all the benefits of a declarative build tool, but it leaves you with a procedural description of what it is doing.
I am looking for more PDE-based projects to test it on. There are a couple RFC-0112 Bundle repositories around, and I have some code for downloading dependencies. If anyone is interested, then I could integrate dependencies download with auto-builder.