i have problem to setting location with the classpath in FLyway, when I use with the filesystem its working properly.
Example:
This working:
this.setLocations("filesystem:C:\\Projects\\ProjectName\\src\\main\\java\\com\\some1\\some2\\some3\\database\\migration");
This NOT working(I try delimiters: "\", ".", "/"): this.setLocations("classpath:ProjectName/src/main/java/com/some1/some2/some3/database/migration");
When not working, its throwing error:
[WARNING] [] [org.flywaydb.core.internal.util.scanner.classpath.ClassPathScanner] [tid: _ThreadID=19 _ThreadName=RunLevelControllerThread-xx] [timeMillis: 1495044249009] [levelValue: 900] [[ Unable to resolve location classpath: ProjectName/src/main/java/com/some1/some2/some3/database/migration]]
I try some delimiters as above, without key word "classpath", and always when I want to use classpath its throwing "Unable to resolve location ...".
I use flyway ver 4.1.2 and by JavaAPI(https://flywaydb.org/getstarted/firststeps/api)
edit./ When I change location of migrating sql files and name of directory on default for Flyway, and not setting location, its working fine. So, conclusion is that I wrong wrote the classpath, but what i do wrong?
Default configuration: 1. main/resources/db/migration < default folder for sql files to migrate 2. not setting location
Some suggestion?
I struggled with the same problem for a couple of days. What finally helped me was to modify pom.xml
, so that<build>
node lists all locations with property files:
<project...>
...
<build>
<resources>
...
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*.*</include>
<include>sql/migration/*</include>
</includes>
</resource>
</resources>
</build>
</project>
'classpath' means really classpath and you can not extend your classpath with a path.
When I see your classpath declaration than I think your migration will be packaged in a jar with the path 'com/some1/some2/some3/database/migration
'
=> so your classpath configuration must be look like:
classpath:com/some1/some2/some3/database/migration
If you use SQL file based migration I have better experience with src/main/resources
as base location.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With