I follow along with the tutorial Hello Spring Security with Boot to learn Spring Security.
After importing it into STS,I got build errors:
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-thymeleaf:jar is missing.
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-web:jar is missing.
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-test:jar is missing.
I thought the sample comes from official GitHub repository, so it should work well. Unfortunately, I encounter build errors.
Then I tried to fix the build errors. I appended <version>1.5.3.release</version> tags in POM file and the errors from POM file disappeared.
But I still encountered an error from main class:
The type org.springframework.context.ConfigurableApplicationContext cannot be resolved. It is indirectly referenced from required .class files
I have used all spring samples from official site and it works.
my sample pom file is as below,
https://github.com/Roshanmutha/rcmutha-springrest/blob/master/pom.xml
Only will have addition and removal as per the sample you are trying.
Click the below link to see all sample which i have tried from spring repo :
https://github.com/Roshanmutha?utf8=%E2%9C%93&tab=repositories&q=rcmutha&type=&language=
Related
I am relatively new to Selenium and Maven. I cloned the project (project for the test automation). I got multiple issues with pom.xml.
There are 2 errors:
1st. error and the biggest one: Missing artifact …
2nd. error: Failed to read artifact descriptor for…
Regarding the first one, I noticed that .jar files do present, but the error messages still indicated. i.e. the error is showing “Missing artifact io.netty:netty-common:jar:4.1.43.Final”, however corresponding .jar file is present in the folder, and it is found in Maven Dependencies section of the Project Explorer.
Same for the error message: “Missing artifact io.netty:netty-transport:jar:4.1.43.Final” is indicated, and the file is present.
See below:
I tried to clean the project, I tried to update the project:
but with no success.
I read other articles here on Stack Overflow where similar problems have been described and discussed but with no success to solve my problem.
Regarding the second one: Failed to read artifact descriptor for… I did not manage to find anything.
Can you also recommend where I can Read about POM and how to set up Maven project in general and dependencies in particular.
Not sure if you have tried the below, if you have not, worth trying.
Right click on the project --> Maven --> Update Project --> Select all the checkbox (including Offline and Force Update) as shown below.
I want to view the ddl generated by spring boot and hence configured "debug=true" in the application properties file, but immediately there is a error in the pom.xml as below. Not sure what is the reason for this error and how to resolve this. Will be grateful to the community for helping me to resolve this.
Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources failed: *newPosition < 0: (-1 < 0) (org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources:default-resources:process-resources)*
Comment in answer here:
Spring boot project crashes if I add any values to application.properties
Suggests: mvn clean
(worked for me)
In a spring boot project who use maven. A class is not found
A part of my pom
<groupId>com.acme.pay</groupId>
<artifactId>ms.billing</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>ms.billing</name>
<packaging>jar</packaging>
<properties>
<default.package>com.acme.pay.ms.billing</default.package>
</properties>
Structure of the project
com
acme
pay
ms
billing
domain
v2
BillingServiceApplication.java
When I start application, I get this error
Error: Could not find or load main class com.acme.pay.ms.BillingServiceApplication
Caused by: java.lang.ClassNotFoundException: com.acme.pay.ms.BillingServiceApplication
Command execution failed.
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:exec (default-cli) on project ms.billing: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
It seem it don't seem in the correct path.
Your problem might be related to your artifactId having a . character in it. I've never seen an artifactId formatted like that and I think it might be messing up the path resolution. Usually people use - as a separator when they want to make an artifactId more readable (as per commons-math in the maven guide linked below).
http://maven.apache.org/guides/mini/guide-naming-conventions.html
choose whatever name you want with lowercase letters and no strange symbols
Can you please confirm if your application is 'Spring Boot' application?
If yes, then while running your application as 'Java application', just choose the main file as 'BillingServiceApplication'. There is no problem with your pom file.
If no, then could you please share your pom file with all dependencies?
I think that you need to change the version of the following dependency
'org.codehaus.mojo:exec-maven-plugin'.
Just check the link for similar question on stackoverflow:
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:java (default-cli)
I hope this helps!
did you annotate your class with #Component, #Services etc
OR
if your class out of the scan scoop you could included it via
#ComponentScan(basePackages = "com.acme.pay.ms.billing")
#Configuration
public class SpringComponentScanApp {
Or you could use xml as in your case via
<context:component-scan base-package="com.acme.pay.ms.billing" />
Package of BillingServiceApplication should be com.acme.pay.ms.billing.BillingServiceApplication
I am developing a binding for the smart home platform openHAB. As mentioned in the docs, I forked the main project and created a new branch and imported the new related project (see picture of my IDE below, the project with the "X").
I was surprised that my new project was creating some errors, which seem to be related to maven. I have no idea where to look to solve this issue.
UPDATE: due to some advice I used my systems maven version and the logs are telling me, that this is probably the main problem:
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[ERROR] 'modules.module[181]' specifies duplicate child module org.openhab.binding.cus # org.openhab.binding:pom:[unknown-version], E:\joba\workspace-openhab\OpenHabAddonDev\openhab-master\git\openhab2-addons\addons\binding\pom.xml, line 201, column 13
at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:383)
at org.apache.maven.graph.DefaultGraphBuilder.collectProjects (DefaultGraphBuilder.java:414)
These are issues related to m2e (The Maven plugin in Eclipse). It tries to mimick Maven which does not work for not-so-standard Maven plugins. Usually, you can repair this by setting the policy to "ignore".
Background:
I am developing Maven multi module project.
One of the module is common module needed by other all modules.
This module contain CommonClassA.java.
common module is properly compiled.
It is installed into maven local repository properly.
One of the class(Billtype.java) in other module (EmployeeBilling) refers this class(CommonClassA.java).
Maven Dependency for common module is properly specified in pom.xml of EmployeeBilling module.
Problem:
While compiling EmployeeBilling module it throws
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project EmployeeBilling: Compilation failure
[ERROR] \MyWorkspace\Biz\EmployeeBilling\src\main\java\com\employee\Billtype.java:[79,19] error: cannot access CommonClassA
[ERROR] -> [Help 1]**
Supporting details:
dependency defined in EmployeeBilling> pom.xml:
Other classes from common module seems accessible as no error observed
There are no other errors like Class not found/file not found.
The class CommonCLassA implements Serializable
Same error occurs from Eclipse as well as commond line
I am using M2E plugin
Tools:
jdk1.7.0_02
OS: Windows 7
Eclipse JUNO and apache-maven-3.1.0
Thanks in advance!
If project builds properly using eclipse compiler then it should work with Maven.
Few things to check if its not working with maven:
Manually check in repository that jar is installed properly and it contains your class file.
Try to build project using locally installed Maven instead of maven in eclipse.
Set -DskipTest=true while installing your jar, as it can cause issues at times.
If these steps don't work then show us your pom.
With no more information it's hard to find the cause. But I also had this problems now and then, and there are some things which could go wrong:
Are you using the right JAVA version (everywhere) ?
... and the right java PROVIDER? (Oracle, IBM, OpenJDK) In my case it's often this issue, I'm sometimes bound to IBM JDK, although I try to use Oracle where I can and this sometimes breaks my build.
Is the right maven dependency VERSION used? If you depend on it multiple times, and all in the same (lower than root) dept of dependencies, Maven will just "choose" a version. It could be that thát version is incompatible with your code of thát particular dependency
Skipping tests sometimes WORKS! It has something to do with maven phases and getting stuff ready for using it elsewhere.
Good luck :)
I had the same problem. Even the jar dependency has the required class files. Finally I deleted the local maven repo and restarted the build. Now it worked without any issue.
It looks like you are using an old version of maven-compiler-plugin (v2.3.2).
I suggest you upgrade it to 3.x. it won't magically fix your issue but it will definitely give you better / more detailed error message.