How to use licensed version of flyway with dropwizard-flyway library - dropwizard

We are using the dropwizard-flyway library from https://github.com/dropwizard/dropwizard-flyway and want to use flyway Enterprise because we have SQL Server 2012. How can we get the license information into the dropwizard-flyway library?
We are trying out the trial version of flyway Enterprise and noticed that it installs its JARs into the maven repo org\flywaydb\trial.... Does this mean that we have to change our maven dependencies for flyway components from org.flywaydb.* to org.flywaydb.trial.* in order to use the trial version?

For others who may run into the same issue, this is how I eventually fixed it:
Download and unzip the flyway enterprise trial version
Navigate to the directory you unzipped into
Run installToLocalMavenRepo.cmd
Run deployToRemoteMavenRepo.cmd - here you will need your remote repo ID and URL. I found these in my distributionManagement section in my projects POM.XML file.
In your project POM.XML file - add an exclusion for flyway-core to the dropwizard-flyway artifact as follows:
<dependency>
<groupId>io.dropwizard.modules</groupId>
<artifactId>dropwizard-flyway</artifactId>
<version>5.0.7</version>
<exclusions>
<exclusion>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</exclusion>
</exclusions>
</dependency>
Add a dependency to flyway-core trial version as follows:
<dependency>
<groupId>org.flywaydb.trial</groupId>
<artifactId>flyway-core</artifactId>
<version>5.0.7</version>
</dependency>
You should now be good to go.

Related

When running mvn versions:display-dependency-updates only some dependencies are processed

When I run
mvn versions:display-dependency-updates
Only some of my dependencies are processed.
For instance I have this dependency.
<dependency>
<groupId>com.github.kagkarlsson</groupId>
<artifactId>db-scheduler-spring-boot-starter</artifactId>
<version>6.2</version>
</dependency>
Im not informed that there is a version 6.6 available. Why is that?
Im using maven 3.6.0
Check if your project pom.xml or your maven settings.xml is not overriding the central repository, if central repo is customized, it may not contain the recent version of this dependency

How to resolve spring security core plug in?

I am having problem with my exercise in Spring Security. I already declare on my pom file:
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>4.2.3.RELEASE</version>
</dependency>
and on my maven dependency, the spring security core jar file is there, but upon importing class UserDetailsService my eclipse cannot found it. I did cleaning and updating my maven project but nothing happens.
Hope someone can advice.
I can't add a comment so I will write here. Have you tried to delete local maven repository?

Create REST API documentation via swagger.io

I have my REST API created with JAX-RS and Resteasy. I annotated with swagger annotation and I would like to generate the documentation by running some task via the Eclipse maven plugin. (Eclipse Luna/Maven 3).
I included the following dependencies in the project .pom
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.2-M2</version>
</dependency>
I create a new configuration under Eclipse -> Run Configuration with a Goal set to Package, but when I run it nothing happens.
Am I missing some dependencies?
Can anyone suggest some tips, I am not making out in using this tool and the site documentation is not helping.
Thanks
take a look at the swagger-samples project, which shows how you need to configure your application after adding the annotations (which, I suggest you update to the latest, 1.5.7).

Maven: dynamic specification of dependencies

I have started to learn Maven and have the following question:
I would like to dynamically specify a dependency for building maven project instead of using the dependency specified in POMs - is there a way to do that?
So although I have the following dependencies specified in POM
...
<dependencies>
<dependency>
<groupId>group</groupId>
<artifactId>ProjectComponent</artifactId>
<version>1.0</version>
</dependency>
...
I would like to specify in the build command that I want to use a different version.
Is there a way to specify this?
The idea is that I want to have an integration build made in Jenkins with a dependency on the latest available snapshot of the system for a particular branch. That snapshot is not released to the maven repository yet, so I would like to fetch it in Jenkins and specify a dependency for mvn build.
Thanks!
POSSIBLE SOLUTION: What I ended up with is to use ${my.lib.version} construction and specify it with -Dmy.lib.version=1.0-SNAPSHOT" when calling to mvn. Thus I can use it for Jenkins integration builds by fetching arbitrary snapshot versions of dependencies from svn and feeding their snapshot versions to the integration build pom.
Maven may use "dynamically" specified property (ex: group.ProjectComponent.version) with the help of profiles.
<dependencies>
<dependency>
<groupId>group</groupId>
<artifactId>ProjectComponent</artifactId>
<version>${group.ProjectComponent.version}</version>
</dependency>
So if you create some profiles you may switch between them (see maven references)
Example:
<profile>
<id>stable-builds</id>
<properties>
<group.ProjectComponent.version>1.0</group.ProjectComponent.version>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>beta-builds</id>
<properties>
<group.ProjectComponent.version>2.0.Beta1</group.ProjectComponent.version>
</properties>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
</profile>
What I ended up with is to use ${my.lib.version} construction and specify it with -Dmy.lib.version=1.0-SNAPSHOT" when calling to mvn. Thus I can use it for Jenkins integration builds by fetching arbitrary snapshot versions of dependencies from svn and feeding their snapshot versions to the integration build pom.
Just came across this as I was looking for something similar. In my case same application code is being reused on different stacks which means using different "drivers" for accessing data. Although drivers implement same interface they do come from different artifacts.
No you can't change the dependencies dynamically. Furthermore it does not make sense, cause you would like to have a reproducible build.

Using Maven API download a JAR

In a simple java program, How can I download a JAR from a Maven repository ?
The repository can be local as well as remote ? I am using Maven 3.
As noted by #amit your use of Maven-3 is not relevant. Your application is interested in accessing a JAR at runtime. It just so happens that this JAR is available at a Maven repository. Maven is a build-time tool. It cannot help you at runtime.
So if we have interpreted your question correctly, the issue is one of formulating the URL and making an HTTP request. Since you say the JAR is hosted by a Maven repository you know the format of the URL:
http://repository.url/group_id_segments_separated_with_slashes/artifact_id/version/artifact_id-version.jar
You can take advantage of this in your program if you need to access more than one JAR in this fashion.
define the necessary mapping for dependency tags in POM.xml and than provide repository information inside repository tags... for example..
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.11</version>
</dependency>
and
<repository>
<id>snapshot-repository.java.net</id>
<name>Java.net Snapshot Repository for Maven</name>
<url>https://maven.java.net/content/repositories/snapshots/</url>
<layout>default</layout>
</repository>
see more about this here

Resources