I'm working on an internal code library for our company, and my main requirement (which I defined myself) is that the code that you check out from the library code repository will be disconnected from that repository to become part of the project once you do the check out. That is, you want to be able to commit the library to the project's repository.
I have created the library as a Salesforce project, so that if someone wants to make changes to the library they can check it out as an independent project and make changes this way.
My initial idea was to use a build tool (Ant, Maven, Composer...) to retrieve the library code from the repository and add it to a project this way. However, it turns out that none of these build tools support checking out the project from a Git repo (what in svn is an "svn export") without having it become a working copy. And our code repository (Atlassian's Stash) does not support pulling down the code in a tar or zip file. Oh, and we do not have an internal Maven repo, so that's not an option either.
So I have decided that I'm going to release the library as a managed package. I'm facing some issues here as well, which is what I wanted to ask the community about (although I'm open for suggestions in what I have covered so far).
The problem with my managed package is that I'm not being able to use the classes in the package from my test project's Apex code. I have made the library classes and methods global, and I have successfully installed the package in my test org. I can see the classes (though not their content of course, since it's a managed package) under the "Referenced Packages" section of my project. But when I get an "Invalid Type" error in the Force.com IDE when trying to instantiate one of the classes in the library, no matter I use the prefix or not. That is, either of these lines of code gives an error:
SoliantGenUtils__Emailer emailer = new SoliantGenUtils__Emailer(); Emailer emailer = new Emailer();
Even though in the installation details I can clearly see that it says "SoliantGenUtils" under the "Namespace Prefix" column, in the "Installed Packages" section.
At this point I'm a little confused. I have worked with managed packages a lot, but I guess I have only referenced classes in a managed package from code also inside the managed package. But I thought you could reference it also from outside the package. Isn't that one of the uses of the "global" keyword?
Any suggestions will be appreciated. Thanks
PS: Another option could be to use an unmanaged package, but that's not good because those cannot be versioned, and obviously we want the library to have version numbers