Using closed-source dependencies with Maven

后端 未结 3 806
生来不讨喜
生来不讨喜 2021-02-05 23:35

I have a closed-source project that I would like to build using Maven. It has a dependency on two java libraries which are not available in any public repository that I\'ve bee

3条回答
  •  日久生厌
    2021-02-06 00:00

    It turns out that Manfred's answer didn't quite work for me. The app compiled, but it did not run on my Android device because the required google analytics classes were missing.

    Following the links he supplied, I discovered this solution which is actually a little cleaner and worked properly.

    In summary, I added the following dependencies to my pom.xml. The groupId, artifactId, and version were all made up by me using reasonable values:

    
        ...
        
            com.google.android.apps.analytics
            libGoogleAnalytics
            1.1
        
        
            com.flurry
            FlurryAgent
            1.24
        
    
    

    I then added a repository definition for where I'm storing the third party dependencies in my project's source tree:

        
            third.party.closed.source.repo
            file://${basedir}/../maven_repo_3rd_party
        
    

    I then moved the jar files to the following location:

    ./maven_repo_3rd_party/com/google/android/apps/analytics/libGoogleAnalytics/1.1/libGoogleAnalytics-1.1.jar
    ./maven_repo_3rd_party/com/flurry/FlurryAgent/1.24/FlurryAgent-1.24.jar
    

    Once I did that, my project compiled and ran exactly as if the third party dependencies were resolved from an official maven repo.

提交回复
热议问题