If the other dependency is also managed by maven, you can build it with
install goal, and it will end up in your local repository and you won't
need to readd it every time. Looking at jar-with-dependencies assembly
definition it only includes runtime dependencies, and this imposes a
question - are system dependencies considered available at runtime?
https://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#jar-with-dependencies


On Tue, Apr 1, 2025, 13:52 w f <wm_...@yahoo.com.invalid> wrote:

> I'm working on an application suite which consists of three (3) Maven
> projects:
> * tm-server
> * tm-client
> * tm-toolib
>
> Current 3rd-party dependencies for tm-server and tm-client are an MQTT
> library and a database library.
> Both tm-server and tm-client are dependent on my tm-toolib. tm-toolib has
> no dependencies.
>
> I have my pom configured such that all dependent jars are rolled into one
> final jar.
>   <plugin>
>     <groupId>org.apache.maven.plugins</groupId>
>     <artifactId>maven-assembly-plugin</artifactId>
>     <version>3.7.1</version>
>     <executions>
>       <execution>
>         <phase>package</phase>
>         <goals>
>           <goal>single</goal>
>         </goals>
>         <configuration>
>           <archive>
>             <manifest>
>               <mainClass>
>                 org.pynkon.tm.client.App
>               </mainClass>
>             </manifest>
>           </archive>
>           <descriptorRefs>
>             <descriptorRef>jar-with-dependencies</descriptorRef>
>           </descriptorRefs>
>         </configuration>
>       </execution>
>     </executions>
>   </plugin>
>
> This works for the 3rd-party jars but not my tm-toolib jar.
>
> My dependencies configured like this:
>   <dependencies>
>     <dependency>
>       <groupId>org.xerial</groupId>
>       <artifactId>sqlite-jdbc</artifactId>
>       <version>3.49.1.0</version>
>     </dependency>
>     <dependency>
>       <groupId>org.eclipse.paho</groupId>
>       <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
>       <version>1.2.5</version>
>     </dependency>
>     <dependency>
>       <groupId>org.pynkon.tm.toolib</groupId>
>       <artifactId>tm-toolib</artifactId>
>       <version>1.0</version>
>       <scope>system</scope>
>
> <systemPath>${project.basedir}/../tm-toolib/target/tm-toolib-1.0-SNAPSHOT.jar</systemPath>
>     </dependency>
>   <dependencies>
> (I get warnings about my tm-toolib but only warnings.)
>
> All three projects compile, but when I execute tm-client, I get a
> ClassNotFoundException
> as soon as the application uses something from tm-toolib
>
> It's almost as if the above stanza for tm-toolib is acting as a
> compile-time stub;
> dependencies are resolved at build time but never included for use at
> runtime.
>
> I know I'm doing something wrong; I just don't know what it is.
>
> Are MQTT and Xerial rolled up in the final jar bc. they're coming from a
> repository?
> Do I have to use "mvn install:install-file ..." on my tm-toolib jar to add
> it to
> my local repository?
> If so, do I have to re-add it each time it's modified?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to