Liquibase : link main yaml changelog from test





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







2















I want to link yaml database creation rules from src/main/resources.. in src/test/resources and add one more chagngelog with sample data.



srctestresourcesdbchangelogdb.changelog-master.yaml :



databaseChangeLog:
- include:
file: ../../main/resources/db/changelog/db.changelog-master.yaml
- include:
file: db/changelog/marketplace/sampleData.yaml


But it doesn't work. So, the error is : Error parsing ../../main/resources/db/changelog/db.changelog-master.yaml



Is there any other options to link main resources from main?
This is a spring boot project.



Error stack trace :



Caused by: liquibase.exception.ChangeLogParseException: Error parsing classpath:/db/changelog/db.changelog-master.yaml
at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:84)
at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:217)
at liquibase.Liquibase.update(Liquibase.java:190)
at liquibase.Liquibase.update(Liquibase.java:179)
at


...



Caused by: java.io.FileNotFoundException: class path resource [../../main/resources/db/changelog/db.changelog-master.yaml] cannot be resolved to URL because it does not exist
at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:195)
at liquibase.integration.spring.SpringLiquibase$SpringResourceOpener.getResourcesAsStream(SpringLiquibase.java:504)
at liquibase.util.StreamUtil.singleInputStream(StreamUtil.java:186)
at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:27)
... 52 more









share|improve this question




















  • 1





    Error parsing.... I bet there will be narrowed message about what exactly cannot be parsed.

    – luboskrnac
    Nov 16 '18 at 12:26











  • @luboskrnac added error trace

    – Anton Barinov
    Nov 16 '18 at 12:34




















2















I want to link yaml database creation rules from src/main/resources.. in src/test/resources and add one more chagngelog with sample data.



srctestresourcesdbchangelogdb.changelog-master.yaml :



databaseChangeLog:
- include:
file: ../../main/resources/db/changelog/db.changelog-master.yaml
- include:
file: db/changelog/marketplace/sampleData.yaml


But it doesn't work. So, the error is : Error parsing ../../main/resources/db/changelog/db.changelog-master.yaml



Is there any other options to link main resources from main?
This is a spring boot project.



Error stack trace :



Caused by: liquibase.exception.ChangeLogParseException: Error parsing classpath:/db/changelog/db.changelog-master.yaml
at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:84)
at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:217)
at liquibase.Liquibase.update(Liquibase.java:190)
at liquibase.Liquibase.update(Liquibase.java:179)
at


...



Caused by: java.io.FileNotFoundException: class path resource [../../main/resources/db/changelog/db.changelog-master.yaml] cannot be resolved to URL because it does not exist
at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:195)
at liquibase.integration.spring.SpringLiquibase$SpringResourceOpener.getResourcesAsStream(SpringLiquibase.java:504)
at liquibase.util.StreamUtil.singleInputStream(StreamUtil.java:186)
at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:27)
... 52 more









share|improve this question




















  • 1





    Error parsing.... I bet there will be narrowed message about what exactly cannot be parsed.

    – luboskrnac
    Nov 16 '18 at 12:26











  • @luboskrnac added error trace

    – Anton Barinov
    Nov 16 '18 at 12:34
















2












2








2








I want to link yaml database creation rules from src/main/resources.. in src/test/resources and add one more chagngelog with sample data.



srctestresourcesdbchangelogdb.changelog-master.yaml :



databaseChangeLog:
- include:
file: ../../main/resources/db/changelog/db.changelog-master.yaml
- include:
file: db/changelog/marketplace/sampleData.yaml


But it doesn't work. So, the error is : Error parsing ../../main/resources/db/changelog/db.changelog-master.yaml



Is there any other options to link main resources from main?
This is a spring boot project.



Error stack trace :



Caused by: liquibase.exception.ChangeLogParseException: Error parsing classpath:/db/changelog/db.changelog-master.yaml
at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:84)
at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:217)
at liquibase.Liquibase.update(Liquibase.java:190)
at liquibase.Liquibase.update(Liquibase.java:179)
at


...



Caused by: java.io.FileNotFoundException: class path resource [../../main/resources/db/changelog/db.changelog-master.yaml] cannot be resolved to URL because it does not exist
at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:195)
at liquibase.integration.spring.SpringLiquibase$SpringResourceOpener.getResourcesAsStream(SpringLiquibase.java:504)
at liquibase.util.StreamUtil.singleInputStream(StreamUtil.java:186)
at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:27)
... 52 more









share|improve this question
















I want to link yaml database creation rules from src/main/resources.. in src/test/resources and add one more chagngelog with sample data.



srctestresourcesdbchangelogdb.changelog-master.yaml :



databaseChangeLog:
- include:
file: ../../main/resources/db/changelog/db.changelog-master.yaml
- include:
file: db/changelog/marketplace/sampleData.yaml


But it doesn't work. So, the error is : Error parsing ../../main/resources/db/changelog/db.changelog-master.yaml



Is there any other options to link main resources from main?
This is a spring boot project.



Error stack trace :



Caused by: liquibase.exception.ChangeLogParseException: Error parsing classpath:/db/changelog/db.changelog-master.yaml
at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:84)
at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:217)
at liquibase.Liquibase.update(Liquibase.java:190)
at liquibase.Liquibase.update(Liquibase.java:179)
at


...



Caused by: java.io.FileNotFoundException: class path resource [../../main/resources/db/changelog/db.changelog-master.yaml] cannot be resolved to URL because it does not exist
at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:195)
at liquibase.integration.spring.SpringLiquibase$SpringResourceOpener.getResourcesAsStream(SpringLiquibase.java:504)
at liquibase.util.StreamUtil.singleInputStream(StreamUtil.java:186)
at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:27)
... 52 more






java database spring spring-boot liquibase






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 12:59









luboskrnac

16.1k54874




16.1k54874










asked Nov 16 '18 at 12:02









Anton BarinovAnton Barinov

687




687








  • 1





    Error parsing.... I bet there will be narrowed message about what exactly cannot be parsed.

    – luboskrnac
    Nov 16 '18 at 12:26











  • @luboskrnac added error trace

    – Anton Barinov
    Nov 16 '18 at 12:34
















  • 1





    Error parsing.... I bet there will be narrowed message about what exactly cannot be parsed.

    – luboskrnac
    Nov 16 '18 at 12:26











  • @luboskrnac added error trace

    – Anton Barinov
    Nov 16 '18 at 12:34










1




1





Error parsing.... I bet there will be narrowed message about what exactly cannot be parsed.

– luboskrnac
Nov 16 '18 at 12:26





Error parsing.... I bet there will be narrowed message about what exactly cannot be parsed.

– luboskrnac
Nov 16 '18 at 12:26













@luboskrnac added error trace

– Anton Barinov
Nov 16 '18 at 12:34







@luboskrnac added error trace

– Anton Barinov
Nov 16 '18 at 12:34














3 Answers
3






active

oldest

votes


















3














I would suggest to name changelog file located in test path differently, because during test, main/test paths are merged into one relative path for the test suite run. I suspect Liquibase thinks that you are trying to include same file recursively.



Just rename your db.changelog-master.yaml under test path to db.changelog-master-test.yaml






share|improve this answer
























  • ok, it's working now, but the problem that it starts with files from test, and then i get an exception, cause there are no tables, which will create in main

    – Anton Barinov
    Nov 16 '18 at 12:52



















1














We include SQL files this way:



  - sqlFile:
encoding: utf8
path: /db/changelog/schema/schema.sql


So try to add slash at the beginning.






share|improve this answer
























  • no, it doesn' help

    – Anton Barinov
    Nov 16 '18 at 12:36



















1














Give the full path instead of ../../main/resources/db/changelog/db.changelog-master.yaml compiler is not able to parse the path in .. format.



Below is enough to load file if the file is present in classpath otherwise give full project context path.



db/changelog/db.changelog-master.yaml





share|improve this answer


























  • I couldn't just hard code the full path of my system, it makes no sence. And it's not in the classpath

    – Anton Barinov
    Nov 16 '18 at 12:23













  • here full path is not system path it is project context path.

    – Alien
    Nov 16 '18 at 12:24












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337527%2fliquibase-link-main-yaml-changelog-from-test%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














I would suggest to name changelog file located in test path differently, because during test, main/test paths are merged into one relative path for the test suite run. I suspect Liquibase thinks that you are trying to include same file recursively.



Just rename your db.changelog-master.yaml under test path to db.changelog-master-test.yaml






share|improve this answer
























  • ok, it's working now, but the problem that it starts with files from test, and then i get an exception, cause there are no tables, which will create in main

    – Anton Barinov
    Nov 16 '18 at 12:52
















3














I would suggest to name changelog file located in test path differently, because during test, main/test paths are merged into one relative path for the test suite run. I suspect Liquibase thinks that you are trying to include same file recursively.



Just rename your db.changelog-master.yaml under test path to db.changelog-master-test.yaml






share|improve this answer
























  • ok, it's working now, but the problem that it starts with files from test, and then i get an exception, cause there are no tables, which will create in main

    – Anton Barinov
    Nov 16 '18 at 12:52














3












3








3







I would suggest to name changelog file located in test path differently, because during test, main/test paths are merged into one relative path for the test suite run. I suspect Liquibase thinks that you are trying to include same file recursively.



Just rename your db.changelog-master.yaml under test path to db.changelog-master-test.yaml






share|improve this answer













I would suggest to name changelog file located in test path differently, because during test, main/test paths are merged into one relative path for the test suite run. I suspect Liquibase thinks that you are trying to include same file recursively.



Just rename your db.changelog-master.yaml under test path to db.changelog-master-test.yaml







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 12:42









luboskrnacluboskrnac

16.1k54874




16.1k54874













  • ok, it's working now, but the problem that it starts with files from test, and then i get an exception, cause there are no tables, which will create in main

    – Anton Barinov
    Nov 16 '18 at 12:52



















  • ok, it's working now, but the problem that it starts with files from test, and then i get an exception, cause there are no tables, which will create in main

    – Anton Barinov
    Nov 16 '18 at 12:52

















ok, it's working now, but the problem that it starts with files from test, and then i get an exception, cause there are no tables, which will create in main

– Anton Barinov
Nov 16 '18 at 12:52





ok, it's working now, but the problem that it starts with files from test, and then i get an exception, cause there are no tables, which will create in main

– Anton Barinov
Nov 16 '18 at 12:52













1














We include SQL files this way:



  - sqlFile:
encoding: utf8
path: /db/changelog/schema/schema.sql


So try to add slash at the beginning.






share|improve this answer
























  • no, it doesn' help

    – Anton Barinov
    Nov 16 '18 at 12:36
















1














We include SQL files this way:



  - sqlFile:
encoding: utf8
path: /db/changelog/schema/schema.sql


So try to add slash at the beginning.






share|improve this answer
























  • no, it doesn' help

    – Anton Barinov
    Nov 16 '18 at 12:36














1












1








1







We include SQL files this way:



  - sqlFile:
encoding: utf8
path: /db/changelog/schema/schema.sql


So try to add slash at the beginning.






share|improve this answer













We include SQL files this way:



  - sqlFile:
encoding: utf8
path: /db/changelog/schema/schema.sql


So try to add slash at the beginning.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 12:23









luboskrnacluboskrnac

16.1k54874




16.1k54874













  • no, it doesn' help

    – Anton Barinov
    Nov 16 '18 at 12:36



















  • no, it doesn' help

    – Anton Barinov
    Nov 16 '18 at 12:36

















no, it doesn' help

– Anton Barinov
Nov 16 '18 at 12:36





no, it doesn' help

– Anton Barinov
Nov 16 '18 at 12:36











1














Give the full path instead of ../../main/resources/db/changelog/db.changelog-master.yaml compiler is not able to parse the path in .. format.



Below is enough to load file if the file is present in classpath otherwise give full project context path.



db/changelog/db.changelog-master.yaml





share|improve this answer


























  • I couldn't just hard code the full path of my system, it makes no sence. And it's not in the classpath

    – Anton Barinov
    Nov 16 '18 at 12:23













  • here full path is not system path it is project context path.

    – Alien
    Nov 16 '18 at 12:24
















1














Give the full path instead of ../../main/resources/db/changelog/db.changelog-master.yaml compiler is not able to parse the path in .. format.



Below is enough to load file if the file is present in classpath otherwise give full project context path.



db/changelog/db.changelog-master.yaml





share|improve this answer


























  • I couldn't just hard code the full path of my system, it makes no sence. And it's not in the classpath

    – Anton Barinov
    Nov 16 '18 at 12:23













  • here full path is not system path it is project context path.

    – Alien
    Nov 16 '18 at 12:24














1












1








1







Give the full path instead of ../../main/resources/db/changelog/db.changelog-master.yaml compiler is not able to parse the path in .. format.



Below is enough to load file if the file is present in classpath otherwise give full project context path.



db/changelog/db.changelog-master.yaml





share|improve this answer















Give the full path instead of ../../main/resources/db/changelog/db.changelog-master.yaml compiler is not able to parse the path in .. format.



Below is enough to load file if the file is present in classpath otherwise give full project context path.



db/changelog/db.changelog-master.yaml






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 16 '18 at 12:29

























answered Nov 16 '18 at 12:20









AlienAlien

5,52331128




5,52331128













  • I couldn't just hard code the full path of my system, it makes no sence. And it's not in the classpath

    – Anton Barinov
    Nov 16 '18 at 12:23













  • here full path is not system path it is project context path.

    – Alien
    Nov 16 '18 at 12:24



















  • I couldn't just hard code the full path of my system, it makes no sence. And it's not in the classpath

    – Anton Barinov
    Nov 16 '18 at 12:23













  • here full path is not system path it is project context path.

    – Alien
    Nov 16 '18 at 12:24

















I couldn't just hard code the full path of my system, it makes no sence. And it's not in the classpath

– Anton Barinov
Nov 16 '18 at 12:23







I couldn't just hard code the full path of my system, it makes no sence. And it's not in the classpath

– Anton Barinov
Nov 16 '18 at 12:23















here full path is not system path it is project context path.

– Alien
Nov 16 '18 at 12:24





here full path is not system path it is project context path.

– Alien
Nov 16 '18 at 12:24


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337527%2fliquibase-link-main-yaml-changelog-from-test%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Lugert, Oklahoma