Import component from add-on directory - spring-boot

I am using Vaadin version 21.0.7 with Spring Boot and i want to import Paginator add-on.
I have added addon's groupId in applicaton.properties as follows: vaadin.whitelisted-packages=com.test.demo,com.vaadin.componentfactory.
The problem is that i get the following error: Paginator cannot be resolved to a type.

Some questions you may want to update your question with answers to:
Are you using Maven? Gradle? Something else?
JDK version?
Is the error a compile-time one? If so, you should add the full output to your question.
Now, for a potential solution:
Assuming you are using Maven...
(1) Make sure that Maven resolved the dependency.
Your IDE should tell you if not, or you can check your local .m2 directory. On Windows, it is located at ${user.home}. On macOS and most Unix/Linux distributions, it is located at ~. Check .m2/repositories/com/vaadin/componentfactory/paginator/<version>/ and ensure that the JARs were downloaded.
If they were not, make sure you
(a) defined the Vaadin Addons repository in your POM, e.g.,
<repositories>
<repository>
<id>vaadin-addons</id>
<url>https://maven.vaadin.com/vaadin-addons</url>
</repository>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
</repositories>
(b) and defined the dependency, e.g.,
<dependencies>
<dependency>
<groupId>com.vaadin.componentfactory</groupId>
<artifactId>paginator</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
(2) Are you using Jigsaw (Java 9+ modules)?
If you are, make sure you specified the dependency:
module myModule {
requires paginator;
}

Related

Lightstreamer java se client maven

I'm trying to use the java client sdk of lightstreamer and I feel like I have an extremely basic question.
When adding the dependencies to my pom.xml like this:
<repositories>
<repository>
<id>lightstreamer</id>
<url>https://www.lightstreamer.com/repo/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.lightstreamer</groupId>
<artifactId>ls-javase-client</artifactId>
<version>4.3.0</version>
</dependency>
</dependencies>
I then only get the following packages in the com.lightstreamer:ls-javase-client:4.3.0
io.netty:netty-codec-http:4.1.31.Final
io.netty:netty-handler:4.1.31.Final
io.netty:netty-handler-proxy:4.1.31.Final
com.cedarsoftware:json-io:4.10.0
com.google.code.findbugs:jsr305:3.0.2
I don't have any of the classes described here:
https://lightstreamer.com/api/ls-javase-client/4.3.0/
Perhaps it has been a long day.
The list of libraries you mentioned are the second level dependencies of the library itself, and should be listed in the file ls-javase-client-4.3.0.pom.
But, the jar file named ls-javase-client-4.3.0.jar should contain the actual library. Maybe something went wrong with your dependency solver? Any warning or error in maven execution?
In any case you could get the jar directly from here: https://www.lightstreamer.com/repo/maven/com/lightstreamer/ls-javase-client/4.3.0/ls-javase-client-4.3.0.jar

Maven repository for QuickFIX/J library

I am using QuickFIX/J in the newest version (1.6.0) and want you to ask if you know any Maven repositories to integrate in my pom file?
I could manually add the jar files to my local repository but maybe there is a nicer and quicker way.
QuickFIX/J version 1.6 and newer can now be found in Marketcetera repository.
Add repository to your Maven pom file:
<repositories>
<repository>
<id>marketcetera</id>
<url>http://repo.marketcetera.org/maven</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
And then the artifact:
<dependency>
<groupId>quickfixj</groupId>
<artifactId>quickfixj-all</artifactId>
<version>${quickfix.version}</version>
</dependency>
${quickfix.version} can be 1.6.0, 1.6.1, or 1.7.0-SNAPSHOT, but also older version are available there. They host both floating point-based and BigDecimal-based versions. The default is floating point. To use BigDecimal versions, append '-bd' to the version.
EDIT (13th August '15):
Unfortunately this QuickFIX/J bundle does NOT contain dependent Apache Mina library for network transportation, you have to add also this to your Maven pom file:
<dependency>
<groupId>org.apache.mina</groupId>
<artifactId>mina-core</artifactId>
<version>${apache.mina.version}</version>
</dependency>
where ${apache.mina.version} is actual version of library (these days it's 2.0.9).
Without that you will be getting NoClassDefFound exceptions.
UPDATE (22.7.2016):
Good news!
Since the release of new QuickFIX/J version 1.6.2 the library is now available from official Maven repository so the only thing you need is following artifact in your pom.xml file:
<dependency>
<groupId>org.quickfixj</groupId>
<artifactId>quickfixj-core</artifactId>
<version>1.6.2</version>
</dependency>
More info at official pages.
You can use the Marketcetera repository. Add this to the list of repositories in your POM:
<repositories>
<repository>
<id>MarketceteraRepo</id>
<url>http://repo.marketcetera.org/maven</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
By the way, you could have looked up this information from the QuickFIX/J User Manual.
Marketcetera switched to using org.quickfix for the group ID, so the proper Maven dependency is:
<dependency>
<groupId>org.quickfixj</groupId>
<artifactId>quickfixj-all</artifactId>
<version>1.6.2-bd-SNAPSHOT</version>
</dependency>

Should I write repositories in my pom.xml?

I am new to Maven. If I start new project with Maven, should I know any repository URLs for it to work?
For example, this Hibernate tutorial http://docs.jboss.org/hibernate/core/3.3/reference/en/html/tutorial.html says about how to create a sample project with pom.xml text. But this pom.xml does not contain any repositories.
So, my m2eclipse plugin says, for example Project build error: 'dependencies.dependency.version' for org.hibernate:hibernate-core:jar is missing., for all dependency tag in pom.xml
Is this because of repositories absence?
Where to know repositories URLs? Is there one big repository? Why doesn't it included by default?
UPDATE 1
It is said here, that Maven should use "central" repository by default: http://maven.apache.org/guides/introduction/introduction-to-repositories.html
I have searched there for hibernate-code artifact and found it. So, this artifact IS in central repository. By my maven says dependency not found. Hence it doesn't use it's central repository. Why?
Apparently your Hibernate dependency is missing <version> tag:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.9.Final</version> <!-- this line is missing -->
</dependency>
Note that you don't have to specify version of dependencies previously declared in <dependencyManagement>.
Old answer:
Every build script (not only with Maven) should be reproducible and independent from environment. Standard pom.xml (called super pom), which every pom.xml inherits from, already defines main Maven central repository:
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
You don't have to define this repository, and you don't have to define any others if all your dependencies are there. On the other hand if you are using some external repositories, you must add them to pom.xml, so that every developer is always able to build.
The bottom line is: if you can build the project having a completely empty repository, your pom.xml is fine.
It's not advisable to define repositories in POM files as that causes a lot of issues (Maven will search those repositories for ANY artifact even the ones available at Central, poor portability, ...)
Best approach: Setup a repository manager (Artifactory, Nexus) and edit your settings.xml file to use the repo manager as a mirror.
Second best approach: Define the required repositories in your settings.xml file, not in your pom.xml files.
Repositories in poms is a bad idea.

Maven can't resolve the dependency it just found

Maven must be losing its mind.
I added a dependency using Netbeans Add Dependency dialog. I searched for jax-rs-ri. It updated the index from central and showed several versions of jax-rs-ri. I selected 1.9.1 and it added this to the pom.xml:
<dependency>
<groupId>com.sun.jersey.ri</groupId>
<artifactId>jax-rs-ri</artifactId>
<version>1.9.1</version>
</dependency>
Looks right, but when I build I get the following error:
Failed to execute goal on project reply-to.test-web:
Could not resolve dependencies for project jms:reply-to.test-web:war:1.0-SNAPSHOT:
Could not find artifact com.sun.jersey.ri:jax-rs-ri:jar:1.10-b03 in
central (http://repo1.maven.org/maven2) -> [Help 1]
I've also tried changing the repository the following with the same results:
<repositories>
<repository>
<id>maven2-repository.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2</url>
<layout>default</layout>
</repository>
</repositories>
This was working earlier today. Did something just get broken with Maven?
In these cases it's worth to check the local repository (usually c:\Users\<username>\.m2\repository\com\sun\jersey\ri\jax-rs-ri or /home/<username>/.m2/repository/com/sun/jersey/jax-rs-ri) and Central:
http://search.maven.org/#artifactdetails|com.sun.jersey.ri|jax-rs-ri|1.9.1|pom
(The important part now is the "Available Downloads" table.)
So, there isn't any jar file just a zip (and the POM). You should use <type>zip</type> in your dependency like this:
<dependency>
<groupId>com.sun.jersey.ri</groupId>
<artifactId>jax-rs-ri</artifactId>
<version>1.9.1</version>
<type>zip</type>
</dependency>
Since it's a zip maybe you want to unpack it. This answer could help: Unzip dependency in maven
Please note that 1.9.1 is not the latest jax-rs-ri version and your Maven uses 1.10-b03. If you want to force it to use 1.9.1 you have to use <version>[1.9.1]</version> inside the dependency tag.

Qi4j maven configuration

I'm currently trying to figure out how Qi4j works. So i decided to start with a simple example. I tried to use the Qi4j lib in my pom.xml and am now facing the problem, that the artifact can't be found. I'm using NetBeans 7.0.1 and my pom.xml parts are shown below:
<repository>
<id>qi4j-official</id>
<url>http://repository.ops4j.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<dependency>
<groupId>org</groupId>
<artifactId>org.qi4j</artifactId>
<version>1.4</version>
</dependency>
I'm i doing something wrong? Thanks a lot.
Qi4j consists of many many artifacts, to keep the total footprint down as most applications won't use all bits and pieces.
<groupId>org.qi4j.core</groupId>
contains the artifacts (as of 1.3)
<artifactId>org.qi4j.core.api</artifactId>
<artifactId>org.qi4j.core.spi</artifactId>
<artifactId>org.qi4j.core.runtime</artifactId>
<artifactId>org.qi4j.core.bootstrap</artifactId>
<artifactId>org.qi4j.core.testsupport</artifactId>
For "compile" scope api and bootstrap should be enough. testsupport is obviously "test" scope and runtime should not be used by your code and only be a "runtime" dependency.
<groupId>org.qi4j.library</groupId>
The Libraries varies greatly in completeness and quality. Extensions can depend on libraries but not the other way around.
<groupId>org.qi4j.extension</groupId>
Extensions implements the slowly growing SPI pluggable functionalities; entity stores, indexing/query and caching. Next release (2.0) will have more extensions for value serialization and others.
Hope that helps, or meet the Qi4j community at the qi4j-dev Google Group for additional support.
Based what i can see in the given repository the groupId and artifactId are completely different...
http://repository.ops4j.org/maven2/org/qi4j/core/org.qi4j.core.spi/1.4/org.qi4j.core.spi-1.4.pom
To learn how to depend on Qi4j in your build see the dedicated how-to that's now present on the Qi4j website: http://qi4j.org/latest/howto-depend-on-qi4j.html
Here are the release and snapshot repositories :
https://repository-qi4j.forge.cloudbees.com/release/
https://repository-qi4j.forge.cloudbees.com/snapshot/
Weekly SNAPSHOTs are uploaded the snapshot repository so you need to add this url as a maven repository :
<repositories>
[...]
<repository>
<id>qi4j-snapshots</id>
<url>https://repository-qi4j.forge.cloudbees.com/snapshot/</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
[...]
</repositories>
And then you can add dependencies to Qi4j:
<dependencies>
[...]
<dependency>
<groupId>org.qi4j.core</groupId>
<artifactId>org.qi4j.core.bootstrap</artifactId>
<version>QI4J_VERSION</version>
</dependency>
<dependency>
<groupId>org.qi4j.core</groupId>
<artifactId>org.qi4j.core.runtime</artifactId>
<version>QI4J_VERSION</version>
</dependency>
[...]
</dependencies>
Where QI4J_VERSION is the version you want to use.

Resources