Skip to content

Instantly share code, notes, and snippets.

@unclebean
Last active October 16, 2024 03:32
Show Gist options
  • Save unclebean/bb3de3c85b82754d3aa70c39bf122b7b to your computer and use it in GitHub Desktop.
Save unclebean/bb3de3c85b82754d3aa70c39bf122b7b to your computer and use it in GitHub Desktop.
maven local dependency
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>install-jar</id>
<phase>validate</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.basedir}/path/to/your-jar-file.jar</file>
<groupId>com.yourcompany</groupId>
<artifactId>your-artifact</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>install-local-jar</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>install-local-jar</id>
<phase>validate</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.basedir}/path/to/your-jar-file.jar</file>
<groupId>com.yourcompany</groupId>
<artifactId>your-artifact</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
spring:
datasource:
url: spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;INIT=create schema if not exists abc\;RUNSCRIPT FROM 'classpath:schema.sql'
driver-class-name: org.h2.Driver
username: sa
password: ""
platform: h2
hikari:
maximum-pool-size: 10
jpa:
hibernate:
ddl-auto: create # or 'update', 'create-drop'
show-sql: true
properties:
hibernate:
dialect: org.hibernate.dialect.H2Dialect
h2:
console:
enabled: true
path: /h2-console
const express = require('express');
const app = express();
// Middleware to parse JSON request bodies (optional)
app.use(express.json());
// Catch-all route to respond to any request
app.all('*', (req, res) => {
console.log(`Received ${req.method} request for ${req.url}`);
// Log request body if there is any
if (Object.keys(req.body).length) {
console.log('Request body:', req.body);
}
// Respond with mock data
res.status(200).json({
message: 'Mock response',
method: req.method,
url: req.url,
headers: req.headers,
body: req.body
});
});
// Start the server on port 3000 (or any other port)
const PORT = 3000;
app.listen(PORT, () => {
console.log(`Mock server is running on port ${PORT}`);
});
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.yourcompany</groupId>
<artifactId>local-jar-installer</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<!-- Install first JAR -->
<execution>
<id>install-local-jar-1</id>
<phase>validate</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.basedir}/path/to/first-jar-file.jar</file>
<groupId>com.yourcompany</groupId>
<artifactId>your-first-artifact</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
</configuration>
</execution>
<!-- Install second JAR -->
<execution>
<id>install-local-jar-2</id>
<phase>validate</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.basedir}/path/to/second-jar-file.jar</file>
<groupId>com.yourcompany</groupId>
<artifactId>your-second-artifact</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
</configuration>
</execution>
<!-- Add more executions for additional JARs if needed -->
</executions>
</plugin>
</plugins>
</build>
</project>
<dependency>
<groupId>com.example</groupId>
<artifactId>your-artifact</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/path/to/your-local-jar/your-file.jar</systemPath>
</dependency>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment