I have an application, BankShots, that uses a jar that I created as a dependency, BankShotsContracts, which has been successfully published to Maven Central. I am unable to access BankShotsContracts from BankShots and continue to get failures when running mvn compile
and mvn install
on BankShots. I am however able to successfully run the same commands on BankShotsContracts.
Has anyone else run into this issue? If so, what am I doing wrong? (I'm very new to Maven)
I have provided the output of each command as well as the pom.xml for both applications and the settings.xml.
Here is the output when I run mvn compile
on BankShotsContracts:
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 1 modules...
[INFO] Installing Nexus Staging features:
[INFO] ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO]
[INFO] -----------< io.github.developerdomjones:BankShotsContracts >-----------
[INFO] Building io.github.developerdomjones:BankShotsContracts< 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ BankShotsContracts ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ BankShotsContracts ---
[INFO] Nothing to compile - all classes are up to date
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.143 s
[INFO] Finished at: 2020-06-03T17:01:15-04:00
[INFO] ------------------------------------------------------------------------
Here is the successful output when I run mvn install
on BankShotsContracts which shows that my jar has successfully installed to the .m2/ folder:
[INFO] Installing /Users/dominiquejones/git/BankShotsContracts/target/BankShotsContracts-0.0.1-sources.jar to /Users/dominiquejones/.m2/repository/io/github/developerdomjones/BankShotsContracts/0.0.1/BankShotsContracts-0.0.1-sources.jar
Here is the failure output when I run mvn compile
on BankShots:
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.bankshots:BankShots >-----------------------
[INFO] Building BankShots 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ BankShots ---
[INFO] Deleting /Users/dominiquejones/git/BankShots/target
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ BankShots ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ BankShots ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 63 source files to /Users/dominiquejones/git/BankShots/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/dominiquejones/git/BankShots/src/main/java/com/bankshots/feature/stock/StockServiceImpl.java:[16,37] package com.bankshotscontracts.entity does not exist
[ERROR] /Users/dominiquejones/git/BankShots/src/main/java/com/bankshots/feature/stock/StockServiceImpl.java:[17,36] package com.bankshotscontracts.model does not exist
[ERROR] /Users/dominiquejones/git/BankShots/src/main/java/com/bankshots/feature/stock/StockService.java:[5,37] package com.bankshotscontracts.entity does not exist
[ERROR] /Users/dominiquejones/git/BankShots/src/main/java/com/bankshots/feature/stock/StockService.java:[6,36] package com.bankshotscontracts.model does not exist
Here is the failure output when I run mvn install
on BankShots:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.489 s
[INFO] Finished at: 2020-06-03T18:02:26-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project BankShots: Compilation failure: Compilation failure:
[ERROR] /Users/dominiquejones/git/BankShots/src/main/java/com/bankshots/feature/stock/StockServiceImpl.java:[16,37] package com.bankshotscontracts.entity does not exist
[ERROR] /Users/dominiquejones/git/BankShots/src/main/java/com/bankshots/feature/stock/StockServiceImpl.java:[17,36] package com.bankshotscontracts.model does not exist
[ERROR] /Users/dominiquejones/git/BankShots/src/main/java/com/bankshots/feature/stock/StockService.java:[5,37] package com.bankshotscontracts.entity does not exist
[ERROR] /Users/dominiquejones/git/BankShots/src/main/java/com/bankshots/feature/stock/StockService.java:[6,36] package com.bankshotscontracts.model does not exist
[ERROR] /Users/dominiquejones/git/BankShots/src/main/java/com/bankshots/feature/stock/StockServiceImpl.java:[36,21] cannot find symbol
[ERROR] symbol: class Stock
[ERROR] location: class com.bankshots.feature.stock.StockServiceImpl
[ERROR] /Users/dominiquejones/git/BankShots/src/main/java/com/bankshots/feature/stock/StockService.java:[10,14] cannot find symbol
[ERROR] symbol: class Stock
[ERROR] location: interface com.bankshots.feature.stock.StockService
[ERROR] /Users/dominiquejones/git/BankShots/src/main/java/com/bankshots/feature/settings/AccountSettingsBusiness.java:[3,37] package com.bankshotscontracts.entity does not exist
[ERROR] /Users/dominiquejones/git/BankShots/src/main/java/com/bankshots/feature/settings/AccountSettingsBusiness.java:[7,32] cannot find symbol
[ERROR] symbol: class Settings
[ERROR] location: interface com.bankshots.feature.settings.AccountSettingsBusiness
[ERROR] /Users/dominiquejones/git/BankShots/src/main/java/com/bankshots/feature/settings/AccountSettingsBusiness.java:[7,16] cannot find symbol
[ERROR] symbol: class Settings
[ERROR] location: interface com.bankshots.feature.settings.AccountSettingsBusiness
[ERROR] /Users/dominiquejones/git/BankShots/src/main/java/com/bankshots/feature/settings/AccountSettingsBusiness.java:[15,51] cannot find symbol
[ERROR] symbol: class Settings
pom.xml for BankShots:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bankshots</groupId>
<artifactId>BankShots</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>BankShots</name>
<description>Description</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--Spring Boot -->
<!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- BankShotsContracts -->
<dependency>
<groupId>io.github.developerdomjones</groupId>
<artifactId>BankShotsContracts</artifactId>
<version>0.0.1</version>
</dependency>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
<!-- Mockito -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.22.0</version>
<scope>test</scope>
</dependency>
<!-- Podam Factory -->
<dependency>
<groupId>uk.co.jemos.podam</groupId>
<artifactId>podam</artifactId>
<version>7.2.3.RELEASE</version>
<scope>test</scope>
</dependency>
<!-- Apache Http Components -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.7</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
</dependency>
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry</artifactId>
<version>1.7.16</version>
</dependency>
<dependency>
<groupId>org.decimal4j</groupId>
<artifactId>decimal4j</artifactId>
<version>1.0.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.github.developerdomjones</groupId>
<artifactId>BankShotsContracts</artifactId>
<version>0.0.1</version>
<configuration>
<mainClass>com.bankshotscontracts.BankShotsContractsApplication</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>bankshotscontracts</id>
</profile>
</profiles>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
pom.xml for BankShotsContracts:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.4.RELEASE</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<groupId>io.github.developerdomjones</groupId>
<artifactId>BankShotsContracts</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>${project.groupId}:${project.artifactId}<</name>
<description>Contract jar for BankShots Application</description>
<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>
<developers>
<developer>
<name>Dominique L. Jones</name>
<email></email>
<organization>DLJ</organization>
<organizationUrl></organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/DeveloperDomJones/BankShotsContracts.git</connection>
<developerConnection>scm:git:ssh://github.com/DeveloperDomJones/BankShotsContracts.git</developerConnection>
<url>https://github.com/DeveloperDomJones/BankShotsContracts/tree/master</url>
</scm>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- Mongo DB -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<!-- Spring Boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>bankshotscontracts</id>
</profile>
</profiles>
</project>
settings.xml from .m2/
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>ossrh</id>
<username>DJones0521</username>
<password>{jira password}</password>
</server>
</servers>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>{pass-phrase}</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
Thanks in advance!