# Cannot load classpath resource in a CustomTaskChange

**URL:** <https://forum.liquibase.org/t/cannot-load-classpath-resource-in-a-customtaskchange/463>\
**Category:** General Discussion\
**Created:** [February 23, 2010, 6:50pm UTC](https://forum.liquibase.org/t/cannot-load-classpath-resource-in-a-customtaskchange/463 "2010-02-23T18:50:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dchicks](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@dchicks](https://forum.liquibase.org/u/dchicks)\
**Post date:** [February 23, 2010, 6:50pm UTC](https://forum.liquibase.org/t/cannot-load-classpath-resource-in-a-customtaskchange/463/1 "2010-02-23T18:50:00Z")

</div>

I had asked about this same problem back in December, but I don’t think I ever found a solution.&nbsp; Now, I’m facing the same problem again, but I don’t think I can so easily step around it as last time.

I have a CustomTaskChange that loads a Spring context configuration.&nbsp; This context contains the various beans I need to perform the migration tasks at hand, without re-writing a lot of code in more traditional JDBC style.&nbsp; I can make this configuration work in a test mode, but when I run “mvn liquibase:update” it fails to find my Spring context file on the classpath.&nbsp; I can see that the context file is in target/classes, though.&nbsp; Currently, my plugin is configured as follows:

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; org.liquibase &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; liquibase-plugin &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ${project.build.directory}/classes/schema/changelog.xml &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ${harvey.database.driver} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ${harvey.database.url} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ${harvey.database.username} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ${harvey.database.password} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; production &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ${project.classpath} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 

Any help?  
Thanks!  
Dave

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [February 23, 2010, 6:50pm UTC](https://forum.liquibase.org/t/cannot-load-classpath-resource-in-a-customtaskchange/463/2 "2010-02-23T18:50:00Z")

</div>

I’m still not that strong on how the maven classloaders work.&nbsp; Is there anyone who has worked with this issue that can help?

Nathan

---

<div class="post-metadata">

**Author:** ![dchicks](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@dchicks](https://forum.liquibase.org/u/dchicks)\
**Post date:** [February 23, 2010, 6:50pm UTC](https://forum.liquibase.org/t/cannot-load-classpath-resource-in-a-customtaskchange/463/3 "2010-02-23T18:50:00Z")

</div>

For the time being, I’ve worked around this problem by calling the Liquibase command line processor directly using the exec-maven-plugin.&nbsp; That way, I can provide my own classpath.

I noticed in the documentation for the liquibase-plugin that, since 1.6.1.0, all files are resolved from the “test” classpath.&nbsp; So, perhaps this problem created is by design, but I don’t really understand why we would specifically exclude the main path.&nbsp; Here is a link to the page:

[http://www.liquibase.org/manual/maven](http://www.liquibase.org/manual/maven)

That’s my best guess, for now.  
Dave

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [February 23, 2010, 6:50pm UTC](https://forum.liquibase.org/t/cannot-load-classpath-resource-in-a-customtaskchange/463/4 "2010-02-23T18:50:00Z")

</div>

That could be.&nbsp; I created [http://liquibase.jira.com/browse/CORE-566](http://liquibase.jira.com/browse/CORE-566) to track the issue

Nathan

---

<div class="post-metadata">

**Author:** ![dchicks](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@dchicks](https://forum.liquibase.org/u/dchicks)\
**Post date:** [February 23, 2010, 6:50pm UTC](https://forum.liquibase.org/t/cannot-load-classpath-resource-in-a-customtaskchange/463/5 "2010-02-23T18:50:00Z")

</div>

Nathan,  
If I can find the time, I might be interested in helping out.&nbsp; Who should I contact about that?  
Thanks,  
Dave

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [February 23, 2010, 6:50pm UTC](https://forum.liquibase.org/t/cannot-load-classpath-resource-in-a-customtaskchange/463/6 "2010-02-23T18:50:00Z")

</div>

Any help would be great.&nbsp; You can email me at nathan at [voxland.net](http://voxland.net) or post to the developer forum.&nbsp;

The svn repository is at [http://liquibase.jira.com](http://liquibase.jira.com)

Nathan&nbsp;
