66 Replies
⌛
This post has been reserved for your question.
Hey @asdru! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
the latest should be 1.5
according to https://repo1.maven.org/maven2/org/apache/maven/archetypes/maven-archetype-plugin/
👍
and you can probably also configure more
now it also created a test class that fails...

Did you run
mvn verify
before making any changes?
oop
What exactly did you run and where?
and how did you run it?
i ran verify from here

i dont think i have maven installed outisde of intelliJ
Can you show the full output?
Is there an mvnw file?
nope
Can you show the pom.xml?
Can you run
mvn test
?
It is possible that it fails because you are running it from IntelliJ
since the integration tests are running Maven on other projects to check the plugin working correctlyoh ok
Can you run
C:\Program Files\JetBrains\IntelliJ IDEA 2024.2.3\plugins\maven\lib\maven3\bin\mvn verify -X
?
or however you run programs with spaces in the path on Windows"C:\Program Files\JetBrains\IntelliJ IDEA 2024.2.3\plugins\maven\lib\maven3\bin\mvn" verify -X
should be like this and it says that it doesnt recognize verifyWhat's the exact wording?
its in italian 😅
"Token 'verify' unexpected in the expression or instruction"
ok that's a PowerShell error
Can you add a
&
at the beginning of the command? so & "C:\..."
I don't use Windows though lol
and especially not PowerShellooh ok it ran but theres no visible output in the terminal
Can you try that one in cmd instead of PowerShell?
Alternatively it might not be
mvn
but mvn.bat
or mvn.cmd
- try using autocompleteThe JAVA_HOME environment variable is not defined correctly,
this environment variable is needed to run this program.
from the powershelloh you don't even have a Java installation configuted outside of IntelliJ
that means you were able to run Maven but it wanted a Java installation
Can you press the ctrl key twice in IntelliJ?
that should pop up a text field I think
yep
try entering
mvn verify -X
there
maybe that worksthis is the full log
You need to specify a goalPrefix as it can not be correctly computed
this is what causes the errorsounds like your plugin misses some configuration
add this to the
<configuration>
of the maven-plugin-plugin:
idk if this causes some of the errors but i copied the pom acactly from here
https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-invoker-plugin/3.9.0

with
YOUR_PLUGIN_PREFIX
being replaced by the short nane of your plugin - goals would then be invoked with mvn YOUR_PLUGIN_PREFIX:YOUR_GOAL_NAME
that's just IntelliJ lying to you and it's kinda normal
once the CLI build works, you can reload the Maven project in IntelliJ and it should realise the plugin existsverify works!

so mvn com.ale:test ?
Can you show your mojo class?
then you can reload the Maven project in IntelliJ to get rid of the visual error/IntelliJ lying about the plugin not existing - if you still have that
hmm i reloaded but its still there
your goalPrefix is
test
and your mojo name is touch
so you could run mvn test:touch
in a project using the plugin
mvn -Prun-its verify
-Prun-its
activates the run-its
profile
which should force the invoker plugin to be downloaded (and it should also run the integration tests for the plugin which is how you'd test the plugin)
tho it did remove the error from the other pom which is nice :)
the pom that's throwing the error is this
no output before that?
this is the full output
both tests passed
ooh its the assertion that failed
yep
Is there a rouch.txt anywhere?
touch.txt*
probably in the
target
directory of the integration test project
or something like thatno there isnt :I
maybe in target of the main project there's a directory for the test with another target directory
Is there a simple-it\target directory?
i created one in
src/it/simple-it/touch.txt
and it did get pasted in the targetI mean the plugin is supposed to create that file but in a different location
Is there really no src/it/simple-it/target directory? Check in the Windows explorer, not just in IntelliJ
nope
should i make one and put touch.txt in there?
Are there any other
target
directories?
nothere's this one but its outside src

The purpose of the sample plugin is to create that file and it seems like it doesn't - your plugin would probably do something else :)
ok yes if the touch.txt wasn't created by you, it means the plugin worked
but idk why the test didn't work lol
So you have a working plugin - but the test seems to have some issues
If in doubt, blame someone/something else - so I blame ... Windows!
no that was generated by maven when i put the touch.txt here
i deleted this and reran
mvn -Prun-its verify
and now it doesnt get generatedCan you run
mvn -Prun-its clean verify
?
that should delete all the output files firstit says it cant find the file

Can you select your main project pom.xml and run that command again?
oh ok now it runs
same error from test fail as before tho, no file found in target/..
Now what exactly is in target?
specifically target/its/simple-it/target
theres no
target/its/simple-it/target
folder
ughh i need to go to sleep... i'll look for another approach tomorrow or maybe even how to make a gradle plugin.
I appreciate the help so far tho, thank you very much
you could running
mvn install
and then trying again
good nightthanks ❤️
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.